Different lightmapping approach(es)

Started by
1 comment, last by GameDev.net 18 years ago
Right now, say I have a lightmap (rendertarget texture) for each wall/floor and when the map is rendered on screen, the wall/floor texture is modulated with the lightmap and then multiplied by 2 (TextureOperation.Modulate2X) for nicer lighting (which I do not want to sacrifice). Problem is that the lightmap needs redrawing whenever a nearby light moves/changes, which requires a change of rendertarget, render the "scene" and switch rendertarget back... this is somewhat of a performance hit... so I want to try a different approach. I would like to try a 2 pass rendering method. This I have in mind like this: - Clear screen black. - Use matrices and map geometry (but no textures) to render the lights additive on the black background. This would theoretically result in a sort of global lightmap from the camera point of view. - Now render the map geometry with only its textures and modulate it with background. This would theoretically result in the textured map with lightmap applied. Now how can I multiply everything by 2 like my old method did? The alpha blending renderstates only allow for modulation :( Can it be done with pixel shaders? which version? or am I looking in the wrong direction with this approach? Help and comments on this would be much appreciated! EDIT: Oh shit that wouldnt work, the "global lightmap" wouldnt look right as I cannot both render additive and ignore Z depth, lighting from behind a pillar would come in front of the pillar and such anomalies. HELP! heh :)
Kind regards,
Pascal van der Heiden

CodeImp - My trademark and website
Advertisement
As far as I know using the lightmaps goes like this :
1 - texture = base/diffuse
2 - texture = lightmap (modulated to base texture)

And it doesn't need 2x passes, only two texture layers. Hmm.. why do you need to change renderer target, are you doing somekind of render-to-texture stuff?

Or you are doing something much more cooler than I did with my lightmaps? :)
Sincerely,Arto RuotsalainenDawn Bringer 3D - Tips & Tricks
How are you storing lightmaps datas? I don't understand the connection from triangle to texel.

This topic is closed to new replies.

Advertisement