Jump to content



Ugly seams in cube terrain

  • You cannot reply to this topic
4 replies to this topic

#1 NewtonsBit   Members   -  Reputation: 102

Like
0Likes
Like

Posted 23 February 2012 - 12:25 PM

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?

Ad:

#2 Waterlimon   Members   -  Reputation: 162

Like
0Likes
Like

Posted 23 February 2012 - 12:29 PM

No idea (i realized that this actually was an idea), but try checking if the winding order of the vertices is right.
My face when i saw i have almost 1000 profile views. I feel popular among random web browsing bots.

#3 NewtonsBit   Members   -  Reputation: 102

Like
0Likes
Like

Posted 23 February 2012 - 12:40 PM

View PostWaterlimon, on 23 February 2012 - 12:29 PM, said:

No idea (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.

#4 SimonForsman   Members   -  Reputation: 1199

Like
0Likes
Like

Posted 23 February 2012 - 05:49 PM

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 don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#5 NewtonsBit   Members   -  Reputation: 102

Like
0Likes
Like

Posted 25 February 2012 - 11:58 AM

View PostSimonForsman, on 23 February 2012 - 05:49 PM, said:

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.






We are working on generating results for this topic
PARTNERS