custom shader for building gradian
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// https://gamedevelopment.tutsplus.com/tutorials/a-beginners-guide-to-coding-graphics-shaders--cms-23313
|
||||
uniform vec3 topColor;
|
||||
uniform vec3 groundColor;
|
||||
uniform vec3 bottomColor;
|
||||
varying vec3 vWorldPosition;
|
||||
void main() {
|
||||
float h = vWorldPosition.y;
|
||||
if(h > 0.0)
|
||||
{
|
||||
gl_FragColor = vec4(topColor,1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// gl_FragColor = vec4(bottomColor,1.0);
|
||||
// h = h * -1.0;
|
||||
// float hh = abs(normalize( vWorldPosition ).y);
|
||||
gl_FragColor = vec4(
|
||||
mix(
|
||||
groundColor,
|
||||
bottomColor,
|
||||
min(abs(h)/100.0,1.0)
|
||||
// min(h/150.0 , 2.0)
|
||||
// max(
|
||||
// pow(
|
||||
// max( hh , 0.0),
|
||||
// exponent
|
||||
// ),
|
||||
// 0.0
|
||||
// )
|
||||
), 1.0
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user