Terrain + Lighting
Well, you could use OGL''s lightning, but you won''t get shadows cast by hills and stuff, so here''s another idea I tried. (It works...)
(My Y-axis is ''Up'')
Let the angle the sun makes over the land be along the (for example X axis. Assume the sun-rays are, by now, perpenducular. Let the distance between a height-point and the next on the X axis be 1.
Do the following for all the rows (Z):
Start at one side of the strip and remember the height of that point. If the next point is more than sin(SunAngle) lower than the remembered value, that point is shadowed, and you now remember the previously remembered number minus sin(SunAngle). If you weren''t lower, your not shadowed and you now remember your own height. Repeat...
Hope I was clear.
If I wasn''t, just reply with your email address and I''ll mail you some source...
Please note that this looks better with higher-res meshes...
Also note that this ONLY accounts for the terrain itself and only works with infinitely distanced light...
hth
ThamasTah
(My Y-axis is ''Up'')
Let the angle the sun makes over the land be along the (for example X axis. Assume the sun-rays are, by now, perpenducular. Let the distance between a height-point and the next on the X axis be 1.
Do the following for all the rows (Z):
Start at one side of the strip and remember the height of that point. If the next point is more than sin(SunAngle) lower than the remembered value, that point is shadowed, and you now remember the previously remembered number minus sin(SunAngle). If you weren''t lower, your not shadowed and you now remember your own height. Repeat...
Hope I was clear.
If I wasn''t, just reply with your email address and I''ll mail you some source...
Please note that this looks better with higher-res meshes...
Also note that this ONLY accounts for the terrain itself and only works with infinitely distanced light...
hth
ThamasTah
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement