Jump to content
  • Advertisement
Sign in to follow this  
Isolier

Calculating Triangles Per Vertices

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, In my current project I have a wireframe terrain rendered from a 256x256 height map. I am wondering how to go about finding the number of triangles that will be rendered given the 65,536 vertices that will be created from the height map. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
65,536 verts would be 256 square. I think terrain dimensions are usually preferred to be 2n+1, but in any case, I think the number of triangles for a given number of verts is:

numTris = (sqrt(numVerts)-1)2*2;

Share this post


Link to post
Share on other sites
Hey,

Thanks for the quick reply, that formula did it. However, one more question: why is it preferred to have terrain dimensions of 2^n+1?

Share this post


Link to post
Share on other sites
I don't do much with terrain, so don't take my word for this. But if the dimension in terms of vertices is 2^n+1, the dimension in terms of quads or pairs of triangles is an even power of two. This can be convenient (and in some cases necessary) for certain algorithms, such as level-of-detail.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!