stk-code_catmod/data/shaders/objectpass.frag
vincentlj ec3fd4fa13 Light: Support for specularmap
The specular map is embedded in the alpha component of texture.
Alpha value of 1. means no specular, alpha of 0. means 100% specular.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14786 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-25 20:19:18 +00:00

27 lines
516 B
GLSL

#version 130
uniform sampler2D tex;
uniform sampler2D lighttex;
uniform int hastex;
uniform int haslightmap;
noperspective in vec3 nor;
void main() {
vec4 light = vec4(1.0);
vec4 color;
if (haslightmap != 0) {
light = texture2D(lighttex, gl_TexCoord[1].xy);
}
if (hastex != 0)
color = texture2D(tex, gl_TexCoord[0].xy) * light;
else
color = gl_Color;
gl_FragData[0] = vec4(color.xyz, 1.);
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
gl_FragData[2] = vec4(1. - color.a);
}