Skip to main content
gamedev.net
🔒 Locked

Terrain Lighting

Started by gamma_strahler Dec 29, 2008 at 6:51 AM 6 replies 1.5k views
Original Post
gamma_strahler
gamma_strahler
Hi, i have implemented a terrain engine which uses geomipmapping. Now i want to implement some lighting, but i have no idea of addressing the correct normals. Since i use different levels of detail (the geomipmaps), i have different sets of vertices and therefore different normals. So if i switch between LOD levels, the shading looks different and the user notices more "popping". So what is the correct solution? Which methods are used for terrain lighting? Can you point me to some good articles? I have searched the web but while there are tons of tutorials and articles for terrain rendering, links that focus on terrain lighting are somewhat rare. Thanks in advance, Gamma_strahler
swiftcoder
swiftcoder
The best advice I can offer you is to implement geomorphing (for both vertices and normals), which will help to hide the popping when LOD changes occur. The other advice is to set up your geomipmapping such that the first transition is quite far from the viewer, which will make the popping less noticeable.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
Specialist84
Specialist84
You can try lightmaps and use one lightmap for all lod states. So you have the best lighting everywhere and popping is barely noticeable.
www.bug-soft.net
Fingers_
Fingers_
If your lighting is dynamic, you can use a normal map. A normal map texture that has the same resolution as your highest LOD mesh is sufficient (as good as per-vertex normals at highest LOD).
gamma_strahler
gamma_strahler
Thanks for your replies!

I think i tend to use a normal map or light map since storing, preprocessing and recalculating the vertex normals needs to much processing power as well as RAM so that this is not the best choice.

But is a single lightmap or normal map sufficient? My terrain has currently a size of 1024x1024 cells. Since i plan to use an even larger terrain (4096 and larger), i suppose it would look blocky if i overlay the terrain with a single map.

What are your experiences?

Thanks in advance,
gamma_strahler
VladR
VladR
Hey ! Nice to see you back gamma_strahler ;)

Once you start playing with the size of terrains, youll find out that 4096x4096 is a miniscule terrain and youll need bigger sizes for acceptable results. So, the best things you can do to save your time is to start coding streaming terrain right away with support for precalculated lightmaps/colormaps/normal maps per each chunk. Youll have one huge colormap for whole terrain and just page in the nearest chunks around the camera. If youre willing to design it, Id go for pregenerated mipmaps which means youd load highest amount of data only for mos relevant chunks around the camera and load smaller mipmaps for remaining ones.


BTW, How`s your radiosity renderer ?
Matt Aufderheide
Matt Aufderheide
Frankly I think any precaluculated stuff like lightmaps is bad (meaning only one time of day is possible and lots of data must be stored).

Here is an idea: use one large normal map and smaller detail normal maps, (could be perlin noise normals, or small tiled normal maps derived from the detail textures), then blend them all together using code that combines normals in the pixel shader (nvdia has a demo that does this called detail normal maps).

In my terrain engine I use a large normal map with perlin noise. My terrain is done using a vertex texture and something like the Hoppe's geometry clipmap demo technique (in my opinion much better than geomipmapping although there are tradeoffs).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.