Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform sampler2D base_texture;
- uniform sampler2D height_texture;
- varying vec2 coord;
- varying vec3 normal;
- void main()
- {
- vec4 baseCol = texture2D(base_texture, coord * 128) * vec4(1.0, 1.0, 1.0, 1.0);
- float NdotL0 = max(dot(normalize(normal), gl_LightSource[0].position.xyz), 0.0);
- vec4 ambient = vec4(0.0, 0.0, 0.0, 1.0);
- ambient.rgb += gl_LightSource[0].ambient.rgb;
- ambient *= gl_FrontMaterial.ambient * baseCol;
- vec4 diffuse = vec4(0.0, 0.0, 0.0, 1.0);
- diffuse.rgb += NdotL0 * gl_LightSource[0].diffuse.rgb;
- diffuse *= gl_FrontMaterial.diffuse * baseCol;
- vec4 specular = vec4(0.0, 0.0, 0.0, 1.0);
- specular += clamp(dot(reflect(vec3(0, 0, 1), normal), normalize(gl_LightSource[0].position.xyz)), 0.0, 1.0);
- specular *= gl_FrontMaterial.specular * baseCol;
- gl_FragColor = clamp(ambient + diffuse + specular, 0.0, 1.0);
- }
Add Comment
Please, Sign In to add comment