principia/data/shaders/gem.fp
ROllerozxa 958f4f5056 Remove references to unused "GI" graphics effect
Assumedly abbreviation of "global illumination", some kind of alternative to the current way of drawing the shadows. Doesn't work very well when enabled, remove it.
2025-03-09 20:55:04 +01:00

23 lines
598 B
GLSL

uniform vec4 color;
UNIFORMS
varying mediump vec3 FS_eye;
varying mediump vec3 FS_normal;
VARYINGS
void main(void)
{
vec3 n = normalize(FS_normal);
float diffuse = clamp(dot(LIGHT, n)*_DIFFUSE, 0., 1.);
float ambient = _AMBIENT + .25*n.z;
vec3 e = normalize(FS_eye);
vec3 R = normalize(reflect(LIGHT, n));
float specular = pow(clamp(max(dot(R, e), .0), 0., 1.), 18.);
specular += pow(clamp(max(dot(vec3(0.,0.,1), n), .0), 0., 1.), 18.);
float shadow = clamp(SHADOW, .5, 1.);
gl_FragColor = specular*vec4(.7) + shadow * color * diffuse + color * ambient;
}