Game Development Community

Incremental Terrain Lighting

by Nick Sandow · in Torque Game Engine · 08/23/2006 (12:19 am) · 3 replies

When I hit Alt-L in the world editor (I'm using TGE 1.4), there is a pause of several seconds while the entire terrain is relit.

My game involves terrain deformation, which I have got working in a rough form from picking apart the terrain and terrain editor code. Because relighting the entire terrain is slow, I'm looking at an incremental relighting strategy.

This would hopefully be fast enough to have dynamic terrain lighting with no noticeable performance hit.

Is there code out there to do this?

Does the TSE do this?

Thanks for listening.

#1
08/23/2006 (12:58 am)
My guess would be you would need to create a seperate thread to process the lightmap, copy it over, and then switch to the new one.
#2
08/23/2006 (1:16 am)
By "incremental lighting strategy", I mean to only relight the changed areas of the terrain.

For example, if just one terrain grid square changes in height, we do not need to relight the entire terrain. We only need to relight the changed square and any others that could be shadowed by the changed square.

Doing this would be a lot faster than relighting the entire terrain. Possibly so much faster that we could do it every frame.

Creating a separate thread might work, but that's still a lot of unnecessary computation. And I want to avoid threads if at all possible.
#3
08/23/2006 (3:54 am)
There's code for exactly this, in TLK. You should take a look.