Archived

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

Elig

Auto calculating normals...

Recommended Posts

Elig    122
Hi. Is there any function in OpenGL or otherwise to dynamically calculate normals? Im currently working on a terrain height map based engine with texturemapping using a viewing range of around 20x20 quads. Each time the position of the camera changes from one square on the heightmap to another, the normals for the new quads that just came into range need to be (re)calculated. As there can be mountains and vallies, the polygons can be facing nearly any direction when we load them off of the height map, so they need to be calculated each time a new section of the map comes into view to ensure that the lighting comes out right. I cant statically assign them normals, as the map is dynamically generated using a fractal terrain generator each time. As the resulting map is so insanely huge, I cant even calculate the normals once, and then load them in when need be because of memory concerns. Right now I have a lot of long strung out equations calculating the normals, but I was wondering if OpenGL had any facilities built into it to automatically calculate the normals. I dont really see why it wouldnt, but then again I dont really see why it would. So I figured I might as well ask. Any help on this would be greatly appreciated. ~Elig

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
http://www.opengl.org/developers/code/mjktips/grid/

But it won''t be any faster than if you did it yourself. If you calculate your own normals, you have the ability to do some tricky stuff like normal averaging and animation.

Share this post


Link to post
Share on other sites