23 lines
484 B
GLSL
23 lines
484 B
GLSL
// https://gamedevelopment.tutsplus.com/tutorials/a-beginners-guide-to-coding-graphics-shaders--cms-23313
|
|
uniform vec3 topColor;
|
|
uniform vec3 horizontColor;
|
|
uniform float offset;
|
|
uniform float exponent;
|
|
varying vec3 vWorldPosition;
|
|
void main() {
|
|
float h = normalize( vWorldPosition + offset ).y;
|
|
gl_FragColor = vec4(
|
|
mix(
|
|
horizontColor,
|
|
topColor,
|
|
max(
|
|
pow(
|
|
max( h , 0.0),
|
|
exponent
|
|
),
|
|
0.0
|
|
)
|
|
), 1.0
|
|
);
|
|
}
|