double-hit-balls/assets/simple_shading_no_tex.fragment

17 lines
393 B
Plaintext
Raw Normal View History

2018-06-17 20:13:04 +00:00
precision mediump float;
uniform float Transparency;
uniform vec4 LightDirection;
varying vec3 fragNormal;
varying vec3 fragColor;
void main() {
vec4 color = vec4(fragColor.rgb, 1.0);
float intensity = clamp(dot(normalize(LightDirection.xyz), -normalize(fragNormal)), 0, 1);
gl_FragColor = vec4(color.rgb * intensity + vec3(0.2, 0.2, 0.2), color.a * Transparency);
}