Jump to content
  • Advertisement
Sign in to follow this  

Ugly seams in cube terrain

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

I'm currently trying to generate procedural terrain from instanced cubes and I'm running into a serious problem: there are sporadic ugly seams between the instanced cubes. As far as I can tell, this is a floating point problem. But I have no idea how to fix it.


My vertex shader is quite simple, and takes input data in the form of bytes to generate the Position of the vertex.


// CALCULATE THE WORLD POSITION.
float4 position = float4(
(ChunkXLoc * 16.0f + input.CubeData.x + input.ChunkData.x) * 30,
(input.CubeData.y + input.ChunkData.y) * 30,
(ChunkZLoc * 16.0f + input.CubeData.z + input.ChunkData.z) * 30,
1.0f);


// TRANSFORM WORLD POSITION TO SCREEN SPACE.
output.Position = mul(position, ViewProj);




Any ideas on how I can get rid of the seams?

Share this post


Link to post
Share on other sites
Advertisement

[s]No idea[/s] (i realized that this actually was an idea), but try checking if the winding order of the vertices is right.


Culling counterclockwise at the moment. Changing this doesn't help.

Share this post


Link to post
Share on other sites
You could try to reduce the spread of the numbers involved by splitting your world into multiple sections where each section has its own coordinate system, this should reduce floating point inaccuracy problems.

Also, do the seems appear even if you zoom in on them and is that image showing the entire world or just a small part of it ?
If its only a small part of the world is it the center part or is it close to an edge of the world ?

What does the data you send to the shader look like ?

Share this post


Link to post
Share on other sites

You could try to reduce the spread of the numbers involved by splitting your world into multiple sections where each section has its own coordinate system, this should reduce floating point inaccuracy problems.

Also, do the seems appear even if you zoom in on them and is that image showing the entire world or just a small part of it ?
If its only a small part of the world is it the center part or is it close to an edge of the world ?

What does the data you send to the shader look like ?


I fixed it by applying a depth bias based on slope. I don't think there's really any other solution at this point.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!