   Dynamic shadows with LOD implementations *results*
  I use chunked lod for my terrain.  I am using shadow mapping for shadow casting, but it doesn't really add simple diffuse lighting.  For diffuse lighting I need to generate normals for every vertex so that I can use the dot product technique.  Here's the problem:  I am finding it harder and harder to generate normals for every patch because I need the border vertices to be averaged with the border vertices of the patches around it (otherwise you can see distinct lines around the patches).  When I am working on a patch, it's very hard to get vertices around it (in other patches), mainly because you don't know which ones exist because they are not uniform because of LOD.  So I'm wondering how do other people generate normals when dealing with a non-uniform LOD mesh?I know some people might suggest lightmapping, but I really need the lighting to be dynamic.  The sun is going to be moving around.  Can you do that with lightmaps?I guess the question isn't specific to any technique, but rather how I can light my terrain that is implemented with LOD.. I'm curious how other people do it?[edited by - okonomiyaki on December 5, 2003 5:24:34 AM]
  there was a thread on this awhile back.  someone had come up with a good dynamic lightmap method but i can''t remember it.i''d probably just pre-generate lightmaps every 30degrees of the sun or something and cross-fade ;  Just an idea:Instead of a lightmap you could create a normal-map. If your terrain is not that big you can just create one big normalmap and do your lighting. If you increase the resolution of the normalmap you can even have bumpmapping I am currently wanting to implement a similar thing, but instead of having one big normalmap for the whole terrain I want to dynamically create one for each chunk, and render the normals into it if needed (using PS2.0). Additionally I want to create a diffuse texture for each chunk and dynamically calculate texture-splatting. If these textures are smartly cached it will probably be quite fast. But the size of the textures will probably very limited. I am thinking about a 32x32 normalmap and a 256x256 diffuse texture for each 32x32 chunk so detailmapping might be worth to add. Currently I don''t got enough time for implementing it. But i am curious about what it will look like ;  Wouldn''t a normal map take longer to create dynamically than a lightmap? ;  The more I think about it the more I really like the normal map idea.  I don''t like the idea of creating several lightmaps and fading between them; why not create a normal map when I could create an extremely detailed one rather than several lightmaps and get (probably) better results.  Seems easier to implement to me also (with my current structure).Yes, the normal map might take longer to calculate, but you don''t have to dynamically calculate it.  You can just calculate one and use it with the dot product technique (just like normals at vertices, except you are extracting normals from a texture).  I don''t want to create lightmaps dynamically (slow) nor use several and fade (lots of memory, don''t know about the results, can''t think of a simple implementation, more texture units, etc.).  I think I''ll implement one detailed normal map (might even try bumpmapping, that might be really cool to add an extra little bit of texture) and use it to calculate lighting.Thanks a lot guys!  If I get it working soon, hWnd, I''ll post a screenshot to show you my results. ;  I just thought a little about it and I realized that there isn''t even a requirement for PS2.0 to render into the normal map. Just use the actual vertex normals as color channel and render the Terrain from above using orthogonal projection and the result should be fine. When I get some time I gonna try to implement it myself, but currently school is really hard but it''s only three weeks until Christmas holidays. When I have got some Screenshots I will present them here too ;quote:Original post by okonomiyaki  With normalmap you''ll get only the first bounce of the light to the surface (diffuse and specular) without selfshadowing. For terrain selfshadowing is vital.And if you really decide to that direction, then try occlusion maps (of some kind, suitable for you), with them you''ll get selfshadowing. Of course you''ll need normalmap too, for correct diffuse&specular term, but that one can be extracted from vertex normals in the pixel shader (i.e. why do you need to precalc that?). That can lead to full bump-mapping, i.e. self-shadowed bump mapping, where self-shadowed term is burned into occlusion map.One possible form of occlusion map may be the viewing angle of the sky in the one axis (make the sun go just like that, for simplicity). In the pixel shader check both angles against current sun direction and get shadow term. Then do bump mapping and get the normal and use it to get diffuse and specular term. Multiply (diffuse + specular)*shadow and have fun!Besides imho precalced lightmaps are not so bad, if you have large objects over the terrain. ;  In my landscape engine Typhoon, normals are stored in normalmaps as suggested in previous posts. The normalmaps are calculated on the fly and cached, for the currently needed patches of terrain. Additionaly, horizon maps are also calculated for the patches. The normalmap and the horizon map are fetched in a pixel shader to calculate the contribution of sun to terrain lighting. This allows dynamic lighting of terrain. Demo is on Typhoon''s site: www.gameprog.it/typhoonThe source code of the HLSL shaders is included so you can maybe take a look at it. Ciao,Stefano Lanzasteflanz@tin.it;  hWnd:  my terrian is static, so I don''t see the need of having a dynamic normal map.  One precalced one should be fine, which makes it even better.Zemedelec:  By self-shadowing I''m guessing you mean casted shadows.  I know that you don''t achieve this with the normal map technique, so I do it with shadow mapping.  Both of those combined should yield pleasing results.  Or did I misinterpret you?  I know nothing of occlusion maps.nooan:  I''ve heard of horizon maps, I need to do some research on those.  Not even exactly sure what they do.  And again, I think a static normal map with suit my needs fine   thanks!  I downloaded your demo but I don''t have PS2.0 compliant hardware.  yet .  I will download it when I have access to one!thanks a lot! ;  You could have a look at Spherical Harmonics for terrain lighting.  This thread discusses the idea, although you''ll need to read up on SH separately.  I think the forum faq has links to some papers. 