-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support disabling rescaling in Clamp to avoid seams with repeating Perlin/Simplex terrains #26
Comments
The Perlin generator is defined here: THREE.Terrain/src/generators.js Lines 396 to 405 in 50b5630
The Simplex generator is defined similarly. You can define your own generator which passes different values to In the provided generators, the X/Y values passed to those functions are The other thing to pay attention to is that every call to |
For example
Where ox, oy are offsets such as (-1,-1), (0,-1), (1, -1), (-1, 0)... It could be due to do with the height range, if one tile/chunk has a different natural height range, could it be being distorted on the y axis relative to other tiles/chunks? Sorry for asking questions here, if there's a better place, I'd be happy to ask there instead. |
Make sure you are passing in exactly the same arguments to noise.simplex for vertices that should have identical locations. My guess is there’s a floating point precision issue somewhere in your code. If you had a seeding issue, the edges of your tiles would not come close to lining up. It seems more likely that you are just passing in X/Y offsets that are very slightly different than expected.
… On Jul 28, 2019, at 11:59 PM, George Campbell ***@***.***> wrote:
For example
Terrain.simplex(
(i + ox * (options.xSegments + 1)) / divisor,
(j + oy * (options.ySegments + 1)) / divisor
) * range;
Where ox, oy are offsets such as (-1,-1), (0,-1), (1, -1), (-1, 0)...
i and j go from 0 through options.xSegments + 1, so I am assuming perfect offsets will be multiples of options.xSegments + 1, however as seen in the image above, there are very small seams.
If the logic above it correct (which I'm not sure about) then it likely means a bit of variation may be arising due to a random seed being improperly set/not set.
Sorry for asking questions here, if there's a better place, I'd be happy to ask there instead.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I've done as much as I could to ensure the x,y inputs for the noise function were correct and each chunk edge had the same correct corresponding x,y coords. However, I was still unable to get the chunks perfectly connecting. Here is a 2x2 grid of 1024x1024 terrains with 15x15 segments, and this gives me these results: I find this very odd, as surely the noise function should output the same values for the same x,y coordinates. I think a solution so I can move on would be to just snap these edges together, and that shouldn't be noticeable. |
That's what I would do. That said, I'd still be willing to bet that the arguments you're passing to (Or is it possible there's some other generator or something else other than the simplex generator that's affecting the points on your terrain plane?) |
Could it be due to Clamp ?
|
Yes, disabling Clamp in the Normalize function fixed it. The seams are no more! |
Good catch! |
In addition to what I mentioned in #27, there's probably an additional factor here around how the shadow interpolation works. Honestly I don't really understand the details and haven't spent much time looking at it since 2014, but I think that the shadows are vertex based and so the calculations won't come out the same for edge vertices with significantly different slopes on either side. Fixing this probably requires using different shadow fragments which might require using a different base texture. |
I found a solution to shadow seams thanks to thrax. The idea is to generate terrain with the outer segments overlapping the other tiles, then computeVertexNormals, and finally to trim the excess segments so the tiles no longer overlap. In other words:
This ensures the shadows take into account neighbouring vertexes at tile extremes. |
Good idea! |
Did you ever finished your project? I'm struggling at the moment with making it seamless: I tried with your noise modification:
But no luck at all...
I also removed the Clamp function, like you commented on here and I'm using the following options:
Edit: I think it has to do with the steps. |
Yes, the problem is at stepping. These two have exactly the same settings, except Any ideas on how to make it seamless? And using something like I think the problem lays here: Line 337 in 5de9c5c
|
So, I replaced the Made it really rough, will post it when I have it cleaned up. |
Feature request:
It would be great to be able to set an x and y offset for perlin / simplex noise, and potentially other noise functions.
The usage in my case would be to create tiles of THREE.Terrain, each positioned next to each-other, with the same simplex noise seed, but with its x, y axes offset so they match the position, and the edges of the tiles match up. Then you will be able to create many tiles of terrain, loading nearby tiles and unloaded distance tiles.
I did try to implement this by just adding an offsetX and offsetY in the simplex function, but the results were not as expected and I wasn't sure how to do this.
Thanks.
The text was updated successfully, but these errors were encountered: