Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Splatting with Lightmap Support

Started by Whorse Aug 18, 2012 at 12:29 PM 0 replies 750+ views
Original Post
Whorse
Whorse
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:


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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.