Calculating Triangles Per Vertices
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.
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;
numTris = (sqrt(numVerts)-1)2*2;
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?
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement