Sign in to follow this  
CodeImp

Different lightmapping approach(es)

Recommended Posts

CodeImp    565
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 :)

Share this post


Link to post
Share on other sites
Arex    204
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? :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
How are you storing lightmaps datas? I don't understand the connection from triangle to texel.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this