webgl-noise icon indicating copy to clipboard operation
webgl-noise copied to clipboard

Possible irregularity around 0,0,0 for Noise3Dgrad

Open TheWand3rer opened this issue 11 months ago • 1 comments

First of all, many thanks for this noise library. I am using your Noise3D gradient function (converted to HLSL though) for a terrain generation system. I have noticed that whenever the function is called with input (0,0,0) it glitches. See here:

Image

As you can see one vertex is completely wrong. If I add a bias of 0.1 on any of the coordinates it goes away (i.e. passing 0, 0.1, 0). I am using the result of the noise function as the height of the vertex.

Image

As far as I can tell the HLSL version of the function is identical, save obviously for the vecn / floatn changes. I realise debugging this must be super hard, but maybe it does this on your end too.

Here's just one octave of the noise, with the other terrain chunks removed:

Image

TheWand3rer avatar Jan 19 '25 18:01 TheWand3rer

Weird. Although integer positions should typically be avoided for any gradient noise (because the function is zero at those points), this should have caught my eye before.

My considerably more recent function "psrdnoise" could be a better choice. Also on Github, in stegu/psrdnoise.

But I should still fix this bug. Thanks for reporting it!

Den sön 19 jan. 2025 19:43TheWand3rer @.***> skrev:

First of all, many thanks for this noise library. I am using your Noise3D gradient function (converted to HLSL though) for a terrain generation system. I have noticed that whenever the function is called with input (0,0,0) it glitches. See here:

Screenshot.2025-01-19.192629.png (view on web) https://github.com/user-attachments/assets/69d17ddd-078b-4187-bc65-4c59e2cfb2d1

As you can see one vertex is completely wrong. If I add a bias of 0.1 on any of the coordinates it goes away (i.e. passing 0, 0.1, 0). I am using the result of the noise function as the height of the vertex.

image.png (view on web) https://github.com/user-attachments/assets/0442cc5e-ea5c-4551-949c-7c7dde3e57ea

As far as I can tell the HLSL version of the function is identical, save obviously for the vecn / floatn changes. I realise debugging this must be super hard, but maybe it does this on your end too.

Here's just one octave of the noise, with the other terrain chunks removed:

image.png (view on web) https://github.com/user-attachments/assets/9aa4a666-6d15-47c7-a483-04209031539e

— Reply to this email directly, view it on GitHub https://github.com/stegu/webgl-noise/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFGK2VQICUUQK56S7LOOOD2LPW6BAVCNFSM6AAAAABVO6VK7CVHI2DSMVQWIX3LMV43ASLTON2WKOZSG44TONZXGE4TGMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

stegu avatar Jan 19 '25 19:01 stegu