• Advertisement

Archived

This topic is now archived and is closed to further replies.

Light mapping wossname

This topic is 5998 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am trying to do a couple of things with my game at the moment and I figure that light mapping is the way forward. The first thing is that I want to have really smooth looking lighting around, for example, a burning torch. The second thing is that I want to do a fog of war. Now the way that I understand light-mapping is that it is like having a big texture file that you then apply to all polygons in a region. This sounds like a huge amount of work to just calculate all of the texture co-ordinates (if I have a model that walks off into the fog of war, I''ve got to do all kinds of serious maths to calc the texture-co-ords on all of the model''s polygons as well as the landscape). Am I totally wrong about how this works? Is light mapping the way forward? Can someone give me some sound advice and principle logic? Thanks, ''Doing the impossible is kind of fun'' - Walt Disney

Share this post


Link to post
Share on other sites
Advertisement
Hi,

well I do not completely understand what you want to do with lightmapping, but I will explain what lightmapping is and how to use it (although not in detail).

Lightmapping is a technique to apply precalculated lighting to a polygon or polygon-set. The trick with lightmaps is that they are just a normal texture but the pixels do not represent the image to be displayed (well actually they do, but that is not the point here) but the light color/intensity for a certain position. When using lightmapping you just use your normal texture as primairy texture and use the lightmap texture as secondairy texture... when you render the image then the lightmap will be used to give the correct light intensity. This only poses one restriction... in order to make the lighting convisible you cannot move the mesh... because otherwise the moved mesh will still use the lightmap from the previous position -> thus looking fake... There is a way around this however by using Dynamic Lightmapping/Projected Lightmapping...
In dynamic lightmapping you recalculate the lightmap for the new position and then apply it to the surface... note however that by doing this you should consider the size of your lightmap as recalculating many pixels takes a lot of clock cycles. Another way is by using projective lightmapping... in this type of lightmapping the shape of the lightmap is static... that is you do not have to recalculate the pixels in the polygon for the new position... however you have to recalculate the lightmaptexturecoordinates (is that one word??) for the new position. Not that this technique actually only looks real when the moving object is the light that produces the lightmap. (as in for example Quake weapon projectiles).

About the fog of war... I really do not know wheter you use a real 3D view or a 3D "isometric" point of view... however... DO NOT USE LIGHTMAPS for that purpose... instead you can use the Fog effect (glFog or... I cannot remember what it was in Direct3D8... but it is there) to create a fog of war... If you want specific tiles to be fogged... just use some semitransparent fog textures and place them correctly to achieve a nice fog effect.

I hope this has helped you, Dark (mitolah@hotmail.com, ICQ: 130925152)

Share this post


Link to post
Share on other sites

  • Advertisement