2013-12-18 19:13:17 -05:00
|
|
|
#version 130
|
2011-11-30 11:56:04 -05:00
|
|
|
uniform sampler2D tex_layout;
|
|
|
|
uniform sampler2D tex_detail0;
|
|
|
|
uniform sampler2D tex_detail1;
|
2011-11-30 14:34:37 -05:00
|
|
|
uniform sampler2D tex_detail2;
|
|
|
|
uniform sampler2D tex_detail3;
|
2013-11-30 16:33:06 -05:00
|
|
|
//uniform sampler2D tex_detail4;
|
|
|
|
|
2013-12-18 19:13:17 -05:00
|
|
|
noperspective in vec3 nor;
|
2014-01-08 19:17:28 -05:00
|
|
|
in vec2 uv;
|
|
|
|
in vec2 uv_bis;
|
2013-12-18 19:13:17 -05:00
|
|
|
|
2013-11-30 16:33:06 -05:00
|
|
|
void main() {
|
|
|
|
// Splatting part
|
2014-01-08 19:17:28 -05:00
|
|
|
vec4 splatting = texture2D(tex_layout, uv_bis);
|
|
|
|
vec4 detail0 = texture2D(tex_detail0, uv);
|
|
|
|
vec4 detail1 = texture2D(tex_detail1, uv);
|
|
|
|
vec4 detail2 = texture2D(tex_detail2, uv);
|
|
|
|
vec4 detail3 = texture2D(tex_detail3, uv);
|
|
|
|
// vec4 detail4 = texture2D(tex_detail4, uv);
|
2013-11-30 16:33:06 -05:00
|
|
|
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 +
|
2014-01-09 12:08:15 -05:00
|
|
|
(1.0 - splatting.a) * detail4);
|
2013-11-30 16:33:06 -05:00
|
|
|
|
2013-12-25 15:40:14 -05:00
|
|
|
gl_FragData[0] = vec4(splatted.xyz, 1.);
|
2013-11-30 16:33:06 -05:00
|
|
|
|
2013-12-23 11:59:55 -05:00
|
|
|
gl_FragData[1] = vec4(normalize(nor) * 0.5 + 0.5, gl_FragCoord.z);
|
2013-12-25 15:48:27 -05:00
|
|
|
gl_FragData[2] = vec4(1. - splatted.a);
|
2011-11-30 11:56:04 -05:00
|
|
|
}
|