Sign in to follow this  
Furion117

QuadTree procedurally generated heighmap

Recommended Posts

Sorry if this has been asked before.

 

I am procedurally generating (very large) terrain and have a problem with discontinuities of chunks with the same LOD.

 

Let's say I start with this at the coarsest level of detail.

[sharedmedia=core:attachments:26718]

 

Whenever I split the top chunk I want to render higher res height maps for each of the children. I use the GPU to do this.

So I make 4 new meshes and 4 new height maps. The maps are seamless if you place them next to each other.

 

The problem is that the children share vertices and when rendering these shared vertices look at different height maps.

 

[sharedmedia=core:attachments:26719]

(Just the bottom 2 children, top 2 omitted) (height maps are two separate textures).

In this diagram when rendering the red child, vertices A and B look to the 'left' texture for a height map value and

when rendering the blue child, vertices A and B look to the 'right' texture for a height map value. They get ever so slightly different

values since the images are continuous between children.

 

I could instead generate the height for each vertex in the vertex shader, but this seems like this would be very slow once I get down to the finest LOD. Especially if I wanted to do bi-cubic interpolation on the heights.

 

I could also compute the height on the CPU side for each vertex but running complex noise functions seem to take upwards of 25-30 ms even for small resolutions. That's my entire frame!

 

Any thoughts?

Edited by Furion117

Share this post


Link to post
Share on other sites

Overlapping your heightmaps by one pixel in each direction should solve this.


I thought of that too, but I'm not sure about how to actually do it. I render the textures using a 2x2 quad and pass in the world coordinates of the 4 corners of a chunk/node.

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