Jump to content
  • Advertisement
Sign in to follow this  
Gumgo

Terrain center vertices

This topic is 3068 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

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
Advertisement
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
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!