Jump to content

  • Log In with Google      Sign In   
  • Create Account

Terrain patch border issue


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


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

#1   Members   

201
Like
0Likes
Like

Posted 24 August 2014 - 05:36 AM

Hello, I'm working on a procedural terrain engine.

 

I'm generating a height map for each terrain patch (QuadTree node) and the vertices are lifted up in the vertex program, but the patches have small cracks on the borders. This is happening because the neighbour terrain patch has its own height map and mesh, so the vertices on the borders don't match up perfectly. Please note that I have the same LOD level on all patches at the moment.

 

One potential fix I can come up with is adding 1 pixel padding on the height map, where the one pixel border is fetched from the neighbour height map. That way the vertices on the edges will be lifted properly. But I've never come across any article talking about this issue, so I'm wondering if I'm doing something fundamentally wrong.

 

This was never a problem on the CPU side, because the vertices on the border got the same noise value for the given X Y Z input. However, now on the GPU side I'm feeding it with the corners of the terrain patch and then the GPU is interpolating between those corner values, which is the input to the noise function.

 

Any clues or suggestions on how I can do this properly?

 

Thanks!



#2   Members   

406
Like
0Likes
Like

Posted 24 August 2014 - 09:30 AM

The general way I've seen people deal with this issue is just adding the 1 pixel padding so your patches overlap at the borders. If you look into World Machine's tiling functionality - that's exactly what it does to solve this problem.



#3   Members   

320
Like
0Likes
Like

Posted 25 August 2014 - 12:58 AM

I had a similar issue with terrain patch borders in my hobby engine where the GPU interpolated the edges of my patches in a wonky way. After panicking and failing miserably with different texture addressing modes in my heightmap texture sampler, I got finally it: make the heightmap texture for a terrain chunk include one extra value on each side (i.e. make the texture contain N+2 values for a chunk of size N in both dimensions) and modify the texture coordinates in vertices accordingly (i.e. "skip" the outermost values outside the actual terrain chunk). The seams I had disappeared completely.

 

EDIT: And I think this is what AdeptStrain suggests come to think of it. Oh well...


Edited by chingo, 25 August 2014 - 01:00 AM.


#4   Members   

201
Like
0Likes
Like

Posted 06 December 2014 - 07:30 AM

Thanks for all the replies. I ended up having one pixel padding on my heightmap and it solves the problem. However, on my procedural planet this becomes an issue between cube faces.

 

Let's take one cube face as an example. The cube face coordinates are X = [-1.0, 1.0] Y = [-1.0, 1.0] and Z = 1.0 and with padding it would be something like -1.1 to 1.1 and then it doesn't match the coordinates on the neighbour cube face.

 

I could do some if statements in the shader, e.g. if X is under -1.0 then it must belong to a different face. I would love to avoid that.

 

Something tells me I don't need padding for the heightmap and I'm going to investigate it further. Any helpful tips are more than welcome.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.