Sam Holder
Sam Holder

Reputation: 45

Unity Terrain Stitching Gaps

So, I'm attempting to create a simple dynamic endless terrain using simplex noise. So far I've got the noise working just fine - however I am having issues with the terrain having discontinuities at the edges. At first I thought this was due to the fact that I was not calling SetNeighbors on the Terrain objects, but adding this did not seem to yield any improvement.

terrain.GetComponent<Terrain>().SetNeighbors(left, top, right, bottom);

This problem seems to be caused by the slight differences in height between each terrain position - but making these set the same will effect the terrain quality (will reduce how jagged the terrain can be in certain cases) and generally seems inelegant. I've been going through the unity docs trying to find how to address this, but have yet to find anything.

Is there something I'm missing? Or is my only option to fiddle the heights on one of the sides to match the other?

Thanks for reading, appreciated as always.

Terrain image for reference

Upvotes: 0

Views: 2862

Answers (1)

HalpPlz
HalpPlz

Reputation: 711

A couple things-

First, make sure you're setting SetNeighbors() on ALL the terrain objects, not just one.

Secondly, if the terrain don't match up exactly, it either means that the terrains aren't calculating their data quite correctly, or there's some floating point error going on. However, I have a suspicion that it's the first one, given that manually changing the points affects the quality. Make sure you know that terrains have n^2 + 1 points, and also make sure that the point to query from your simplex function with is calculated in world space.

If you can't figure it out, post your code and I'll take a look.

Also, your terrain might look better if you used octaved (a.k.a factal) noise on your Simplex noise function, depending on what you're looking for.

Cheers!

Upvotes: 1

Related Questions