Original Post
Hey there. I've recently been attempting to add in support for lightmaps with splatting in a game I'm working on. Right now every attempt I've made has just mixed the original overlay colours with the lightmap and disregards the splatting colours completely.
Here's a sample of my code with the extra multiplication by the lightmap:
If anyone knows the correct method to apply the lightmap over the added details, I'd love to hear their techniques.
Here's a sample of my code with the extra multiplication by the lightmap:
vec4 splatting = texture2D(tex_layout, gl_TexCoord[0].st);
vec4 d0= texture2D(tex_detail0, gl_TexCoord[1].st);
vec4 d1 = texture2D(tex_detail1, gl_TexCoord[1].st);
vec4 d2 = texture2D(tex_detail2, gl_TexCoord[1].st);
vec4 d3 = texture2D(tex_detail3, gl_TexCoord[1].st);
vec4 d4 = texture2D(tex_detail4, gl_TexCoord[1].st);
vec4 lightmap = texture2D(lightmap, gl_TexCoord[0].st);
gl_FragColor = (((splatting.r * d0 + splatting.g * d1 + splatting.b * d2) + (1.0 - splatting.r - splatting.g - splatting.b) * d3 +
(1.0 - splatting.a) * d4) * lightmap) * min(1.0, 0.2 + dot(lightdir2, normal)) * vertex_color;
If anyone knows the correct method to apply the lightmap over the added details, I'd love to hear their techniques.