Fast terrain self-shadowing

Blitz3D Forums/Blitz3D Programming/Fast terrain self-shadowing

JoshK(Posted 2004) [#1]
I optimized my lightmapper by about 400% from just the unoptimized Blitz picking commands.

Self-shadowing terrain is by far the slowest step. I have a 32,000 poly terrain, split into 16 sectors, and it takes maybe four or five minutes to light with two directional lights. Anyone have experience writing optimized terrain shading? It seems like the unique nature of terrain meshes could be taken advantage of to speed this up.


TartanTangerine (was Indiepath)(Posted 2004) [#2]
I did one for terrains and it's pretty fast. The shading is generated by calculating the normals direction in relation to the sun. The shadows are generated by checking to see if the point is occluded. As I say I use terrains (Bitmaps) to provide the height information, there is no reason why you could not use a mesh terrain and use vertex positions - you may need some interpolation if your terrain is not in a grid format. And for the normals use the VertexNX() etc... commands.

Here is the link : http://www.blitzbasic.com/codearcs/codearcs.php?code=1004


JoshK(Posted 2004) [#3]
That's much, much faster than picking geometry. Thanks.