Sign in to follow this  
Gumgo

Terrain center vertices

Recommended Posts

It seems like the most common approach to rendering terrain is to draw the triangles like this:
+--+--+--+
|\ |\ |\ |
| \| \| \|
+--+--+--+
|\ |\ |\ |
| \| \| \|
+--+--+--+
|\ |\ |\ |
| \| \| \|
+--+--+--+
However, this seems like because all the diagonals are facing the same direction, terrains that have been "mirrored" will not look the same, and other possible artifacts could occur in somewhat sharp corners. I was thinking about doing terrain like this instead:
+--+--+--+
|\/|\/|\/|
|/\|/\|/\|
+--+--+--+
|\/|\/|\/|
|/\|/\|/\|
+--+--+--+
|\/|\/|\/|
|/\|/\|/\|
+--+--+--+
With the center vertex's height being the average of the surrounding corners. It seems like this would be more consistent in both directions. Is this ever done, or rather, is it worth doing? If so, has anyone figured out a more efficient way to store indices/render? I know you can use GL_TRIANGLE_STRIP for the first technique but I couldn't figure out an easy way to get that to work with this. If not, what better approaches are there, or is it even worth doing differently than the first way?

Share this post


Link to post
Share on other sites
If you like bookkeeping and you want to write a terrain editor, you can store 1 bit per quad (two triangles) somewhere. If the bit==0, render the triangles 0-1-2, 0-2-3. Else render triangles 0-1-3, 1-2-3. That decision can be made when index buffers are setup (if that's how you're doing it). However, editing a large terrain (e.g., clicking on a quad to swap rendering order) can be a pain.

Your method won't be exactly correct and requires more memory and time to render (4 triangles vs. 2), but you may like the looks better.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this