Archived

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

_goat

"Smoothing" normals for terrain

Recommended Posts

All right. So I''ve created a stupid array of triangles, and render them (DX8.1). I have normals, however the normals for each triangle are all the same, so I have sharp angles of light between each triangle. Firstly, what is the math (and small explanation in implementation) to make each normal the average of the ones around it? Secondly, this is a "stupid" terrain. Any help with better implementations (index buffers, other stuff which I''ve read around here) would be very helpful, because I''ve yet to find an article that helps with terrain implementation. - Cheers I''''m not easily impressed. Ooh! A blue car!

Share this post


Link to post
Share on other sites
say three triangles share one vertex, that vertex has three normals...

a quick-and-easy way would be to take the numerical mean of the components of each vector [(x1+x2+x3)/3,(y1+y2+y3)/3,(z1+z2+z3)/3] then normalise

********


A Problem Worthy of Attack
Proves It''s Worth by Fighting Back

Share this post


Link to post
Share on other sites
secondly: assuming you''ve a heightmap for your terrain, it''s very easy to make triangle strips of it. just make a triangle strip of each row. don''t store the vertex data in an additional structure for the triangle strips but store the vertex indices...

GA

Share this post


Link to post
Share on other sites
Yeah. I could have done it in triangle strips. But I just read up on index buffers, and they seem to be the way for terrain and sky (where both are textured).

And thanks for the maths.

I''''m not easily impressed.
Ooh! A blue car!

Share this post


Link to post
Share on other sites