cables-gl / cables

cables is a tool for creating beautiful interactive content
https://cables.gl
MIT License
345 stars 15 forks source link

cpu perlin noise sucks #1702

Closed pandrr closed 3 years ago

pandrr commented 4 years ago

we need a better one, its flickering and scaling/repeat/precision problems

androvisuals commented 4 years ago

Maybe I can check if we get the same problems or not with the array based version? Seems to be smooth in this patch

androvisuals commented 4 years ago

Seems to work smoothly though I really have trouble getting it to flicker with a repeat set to 2048 and 3 instances of perlin on a sphere. @pandrr Do you have a patch showing the problem? I tried a version with a trigger in and I think like the patch I posted above this would solve the problem.

pandrr commented 4 years ago

CPU not GPU

pandrr commented 4 years ago
androvisuals commented 4 years ago

Putting the random cluster op size to 1 and then playing with the seed number only shows a few black spheres. I think it seems that way because most of the spheres aren't visible on the screen. This perlin algorithm also seems to work best with numbers above 1, getting the rnd output from random cluster and multiplying it by a number like 4 or higher gives much more noisy results

But you're right these outputs shouldn't really happen with a good perlin noise algorithm.

image

image

simodrws commented 4 years ago

I was googlin a little bit.. I found this implementation that introduces a jitter to make 0 values less likely:

https://github.com/jeremyosborne/trinkets/tree/master/packages/noise

Has no external dependencies, but needs to be built with rollup. Also MIT licensed.