Jump to content
  • Advertisement
Sign in to follow this  
dnaxx

Terrain gaps

This topic is 4772 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, I have seperated my terrain into quads. Depending on the distance from the viewer to the quad, the quad is displayed in fitting level of detail. Between the quads, there might occur gaps. Currently I am connecting these points with a new triangle ("skirts"). But it looks very ugly: Picture 1(http://members.kabsi.at/devp/prob2.jpg): Gaps when texturing is used Picture 2(http://members.kabsi.at/devp/prob1.jpg): The mesh. How can I fix this problem, or are there better (same/better speed + not to difficult) ways to generate the terrain (btw: I'm using OpenGL)? Thanks,

Share this post


Link to post
Share on other sites
Advertisement
You need to avoid 'T' junctions, aiming for a smooth transition between detail levels. It's generally best to keep neighbouring tiles within one level of detail, and work out some sort of transition scheme, e.g something like this:


+---+---+---+---+-------+-------+
|\ |\ |\ | /|\ |\ |
| \ | \ | \ | / | \ | \ |
| \| \| \|/ | \ | \ |
+---+---+---+ | \ | \ |
|\ |\ |\ |\ | \ | \ |
| \ | \ | \ | \ | \ | \ |
| \| \| \| \| \| \|
+---+---+---+---+-------+-------+
|\ |\ |\ | /|\ |\ |
| \ | \ | \ | / | \ | \ |
| \| \| \|/ | \ | \ |
+---+---+---+ | \ | \ |
|\ |\ |\ |\ | \ | \ |
| \ | \ | \ | \ | \ | \ |
| \| \| \| \| \| \|
+---+---+---+---+-------+-------+


Of course, this approach gives rise to a new kind of visual artifact, known as 'popping' - caused by sudden changes in the mesh as it changes detail level. These can be avoided using a technique known as geomorphing, or can be ignored altogether if the effect is small.

Share this post


Link to post
Share on other sites
Whilst quads might be nice and easy to work with they aren't the most efficient. For large terrain triangle-strips are optimul. Using indexed gemoetry helps with vertex caching and can reduce small gaps appearing between polygons when floating-point numbers are rounded.

Share this post


Link to post
Share on other sites
A simpler way to fix the problem is to draw a "skirt" around each quad.

Pros: The geometry is static, so no time is spent constructing it and sending it to the GPU.
Cons: It means drawing extra geometry (+13% for a 33x33 quad).

Share this post


Link to post
Share on other sites
ups. I got the problem: I assigned the wrong texture coordinates to the skirts. now it works.

Share this post


Link to post
Share on other sites
Edit: HURR I can't read, I didn't notice that you were using LOD... The following post doesn't apply to you, but I'll keep it here in case it helps someone in the future.

Correct me if I'm wrong, but you shouldn't need skirts, unless you're using LOD.

I had a very similar problem with my terrain engine last week.
The problem was that terrain chunks weren't sharing vertices at their edges, so in the example below...



Chunk 1 Chunk 2
======= =======
0 1 2 3 4 0 1 2 3 4
| \ | \ | \ | \ | | \ | \ | \ | \ |
5 6 7 8 9 5 6 7 8 9
| \ | \ | \ | \ | | \ | \ | \ | \ |
10 11 12 13 14 10 11 12 13 14
| \ | \ | \ | \ | | \ | \ | \ | \ |
15 16 17 18 19 15 16 17 18 19


Vertex 0 in chunk 1 wasn't the same vertex as vertex 4 in chunk 1. The solution was to change the terrain generation algorithm, so that adjecent terrain chunks shared vertices. So, vertex 4 in Chunk 1, is actually the same as vertex 0 in Chunk 2

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!