stk-code_catmod/data/shaders/splatting.frag
vincentlj c2b18a0a1c Light: Export the correct value for specmap in grass/splatting shaders
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14789 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-25 20:48:27 +00:00

33 lines
1010 B
GLSL

#version 130
uniform sampler2D tex_layout;
uniform sampler2D tex_detail0;
uniform sampler2D tex_detail1;
uniform sampler2D tex_detail2;
uniform sampler2D tex_detail3;
//uniform sampler2D tex_detail4;
noperspective in vec3 nor;
void main() {
// Splatting part
vec4 splatting = texture2D(tex_layout, gl_TexCoord[1].st);
vec4 detail0 = texture2D(tex_detail0, gl_TexCoord[0].st);
vec4 detail1 = texture2D(tex_detail1, gl_TexCoord[0].st);
vec4 detail2 = texture2D(tex_detail2, gl_TexCoord[0].st);
vec4 detail3 = texture2D(tex_detail3, gl_TexCoord[0].st);
// vec4 detail4 = texture2D(tex_detail4, gl_TexCoord[0].st);
vec4 detail4 = vec4(0.0);
vec4 splatted = (splatting.r * detail0 +
splatting.g * detail1 +
splatting.b * detail2 +
(1.0 - splatting.r - splatting.g - splatting.b) * detail3 +
(1.0 - splatting.a) * detail4)
* gl_Color;
gl_FragData[0] = vec4(splatted.xyz, 1.);
gl_FragData[1] = vec4(normalize(nor) * 0.5 + 0.5, gl_FragCoord.z);
gl_FragData[2] = vec4(1. - splatted.a);
}