Archived

This topic is now archived and is closed to further replies.

malachii

Questions about lighting a ROAM landscape

Recommended Posts

malachii    122
I''ve implemented a ROAM based landscape algorithm based on the thoughts written in the article on gamasutra.com. After hours of toil, sweat, and other unpleasant things, it''s finally working. The trouble though, is that I have no idea with this algorithm how to calculate the gouraud shading normals. I have all the face normals of course, but due to the recursive nature of the algorithm, I have access to only one triangle at a time. Does anybody have thoughts on this? Should it be done during tesselation, or during rendering? One possible way (very RAM hungry however) is to calculate all the normals ahead of time and somehow store them in an array, and use those. My landscape is 1024x1024 vertices however, and (1,000,000 x sizeof(D3DXVECTOR3)) = BIG memory. Hmmmmmm. I could use 3 bytes per vertex (so, 3,000,000 bytes total) for the normal. The X value would be using 0 to 100 in the first byte, Y the same in the second byte, and Z the same in the third byte. And insert a fictional decimal place so 0.00 to 1.00. That might work and be a close enough aproximation. I think I may try that. I''ve thought about light maps, but would I not require an obscene amount of textures (large sizes) to correctly light a 1,000,000 vertex landscape? How good is bilinear filtering? Could I enable that and use a texture the same size as the landscape (1024x1024 vertices) to light the whole thing? Then I would have only 1 light value per vertex though. I wonder how that would look? I guess I have to try both methods. Any thoughts would be appreciated.

Share this post


Link to post
Share on other sites
bishop_pass    109
Do not calculate your vertex colors based on the tesselated mesh. If you did, your lighting would change as the tesselation changes.

Take your original height field, and calculate a 2d color array based on the topography of the height field and the light source. Use that 2d color array as a texture map which is draped over your tesselation.

Share this post


Link to post
Share on other sites
malachii    122
So you are suggesting my lighting be done with a light map? My colours will actually be coming from textures however. I assume you were talking about lighting when talking about colouring in your post.

I have two "problems" with this lighting method (thanks for your comments about not doing anything during tesselation due to the change. Makes sense - thanks).

1. Are you suggesting a light/dark map based on textures, or based on directly assigning colour attributes to the vertices?

2. Would a 1024x1024 light map be sufficient given that I''m using a 1024x1024 height map as well (1 point of light per vertex in other words).

3. If I use light maps, then I should probably turn off lighting while drawing the landscape, since my lights are pre-determined, correct? If This is the case, will explosions and such be able to light my landscape? Don''t I require gouraud shading be enabled for good point lights to have an effect on my landscape?

Thanks!

Mal.

Share this post


Link to post
Share on other sites
bishop_pass    109
Merge your color textures with the light map to create one texture or use an modulation map based on the lighting calculations.

If your height field is 1024 x 1024, then use that size texture map for lighting. I''ts up to you how much is resident at any one time. Maybe all of it.

Turn off lighting for your landscape. For explosions, come up with some other method. Maybe another map.

Share this post


Link to post
Share on other sites