model-converter-python/assets/shaders/shader.frag

22 lines
542 B
GLSL
Raw Normal View History

2016-11-25 10:27:05 +00:00
varying vec3 fNormal;
vec3 ambientLight = vec3(0.2,0.2,0.2);
vec3 directionnalLight = normalize(vec3(10,5,7));
vec3 directionnalLightFactor = vec3(0.5,0.5,0.5);
2016-11-30 09:08:37 +00:00
uniform sampler2D tex;
2016-11-25 10:27:05 +00:00
void main() {
vec3 ambientFactor = ambientLight;
vec3 lambertFactor = max(vec3(0.0,0.0,0.0), dot(directionnalLight, fNormal) * directionnalLightFactor);
2016-11-30 09:08:37 +00:00
vec4 noTexColor = vec4(ambientFactor + lambertFactor, 1.0);
2016-11-30 10:10:08 +00:00
vec4 color = texture2D(tex, gl_TexCoord[0].st);
2016-11-30 09:08:37 +00:00
vec4 fragColor = noTexColor * color;
gl_FragColor = fragColor;
2016-11-25 10:27:05 +00:00
}
2016-11-30 09:08:37 +00:00