PDA

View Full Version : multipass light map ?



wizzo
07-22-2003, 01:43 AM
hi !

I last multitextured on a quads a regular texture and a light map texture. it looks great, no problem

then i added a decal (an affiche on a brick wall), but as the decal is added after the light map, it isn't affected by the light map and is way too bright.
so i render the wall, then apply my decal, then redraw the wall with my light map texture.

but when i set my glBlendFunc (as i draw the second quad with lightmap) at glBlendFunc(GL_DST_ALPHA,GL_ONE); (and i tried most of the others too), the black part of the texture is fully transparent, which is normal, cause that's the way it works (black = transparent, white stays) but that's not like a correct light map...

so what am i suppose to do : i tried all parameter for the blendfunc and nothing look great

thx for help

wizzo

*******************************************

forget about it !! i'm an idiot, i posted too fast : glBlendFunc(GL_DST_ALPHA,GL_ONE);
seems to work but it doesnt render as good as ultitexturing though.
excuse me for posting too fast

wizzo

[This message has been edited by wizzo (edited 07-22-2003).]

errno
07-22-2003, 03:02 AM
you should use glBlendFunc(GL_DST_COLOR , GL_ZERO) or glBlendFunc(GL_ZERO, GL_SRC_COLOR) for second pass lightmapping.
this blend func corresponds to GL_MODULATE parameter when using multitexturing lightmapping.

if your lightmap is a RGB texture, you should use this blend func.
if your lightmap is an alpha texture, you should use glBlendFunc(GL_ZERO, GL_SRC_ALPHA).

wizzo
07-22-2003, 06:39 AM
hum thats weird, caus glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); did very well (looks exactly like multitex) but the decal isn't "shadowed"
i didn't use any glPolygonOffset or anything, so i dont see why the two texture dont blend

wizzo