19 lines
408 B
GLSL
19 lines
408 B
GLSL
|
#version 300 es
|
||
|
|
||
|
// fragment shaders don't have a default precision so we need
|
||
|
// to pick one. mediump is a good default. It means "medium precision"
|
||
|
precision mediump float;
|
||
|
|
||
|
in vec4 pos;
|
||
|
in vec3 baseColor;
|
||
|
in vec3 maxColor;
|
||
|
out vec4 outColor;
|
||
|
|
||
|
void main() {
|
||
|
float y = pos.z;
|
||
|
if (y < 0.0) {
|
||
|
y = y * -1.0;
|
||
|
}
|
||
|
vec3 color = mix(baseColor, maxColor, y);
|
||
|
outColor = vec4(color, 1.0);
|
||
|
}
|