QuadTree procedurally generated heighmap

Started by
2 comments, last by Furion117 9 years ago

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?

Advertisement

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

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

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.

Fixed it by using a compute shader and overlapping the textures.

This topic is closed to new replies.

Advertisement