WardBenjamin / SimplexNoise

C# Simplex Noise (1D, 2D, 3D). Supports arbitrary sizes and scales.
BSD 3-Clause "New" or "Revised" License
160 stars 38 forks source link

Strange disconnect in 2D in -X+Y and +X-Y quadrants #7

Open akastormseeker opened 5 years ago

akastormseeker commented 5 years ago

What steps will reproduce the problem? Generate noise using CalcPixel2D() in all four cartesian quadrants

for(x = -1000; x <= 1000; x++) { for(y = -1000; y <= 1000; y++) { map[x,y] = Noise.CalcPixel2D(x, y, 100); } }

What is the expected output? What do you see instead? Expected: smooth gradients between "hills" and "valleys" all across the map Instead: Two lines, roughly 22.5 degree and 67.5 degree angles, passing through 0,0, from -X/+Y to +X/-Y quadrants

What version of the product are you using? On what operating system? Master branch, Windows 10

Please provide any additional information below. I was experimenting with custom Minecraft procedural world generation. The base terrain level function was this: //---------------------------------- // chunks are 16x16 block sections, that go off to +/- infinity in X and Z directions, 0-255 in Y (height) direction // get offset to absolute block coordinates int offsetX = chunk.x 16, offsetZ = chunk.z 16; for(int x = 0; x <= 16; x++) { for(int z = 0; z <= 16; z++) { columnHeight = baseHeight + (int)(Noise.CalcPixel2D(offsetX + x, offsetZ + z, 100) * 16); for(int y = columnHeight; y >= 0; y--) { chunk.SetBlock(x, y, z, Blocks.Stone); } } } //---------------------------------- When standing at 0,0 there are two very obvious lines of discontinuity.

Screenshot

Catdll commented 4 years ago

Were you able to solve the problem?

DoogeJ commented 3 years ago

I think I have found the same bug/issue:

image

WardBenjamin commented 3 years ago

Hi all - apologies for the radio silence. I'm not the original author of the noise algorithm so I have limited knowledge on how it actually works. @DoogeJ @asklar if one of you can provide a minimum example that I can run, I'm happy to take a look.

DoogeJ commented 3 years ago

@WardBenjamin Thanks for the response and taking the time to take a look!

I have made a small repository displaying the issue(s) here, with a readme explaining how to run it: https://github.com/DoogeJ/SimplexNoiseTest

Markinatorina commented 1 month ago

I have the same issue. @WardBenjamin has anyone figured this out privately, because I don't see any posts here?