vlang / vsl

V library to develop Artificial Intelligence and High-Performance Scientific Computations
https://vlang.github.io/vsl
MIT License
340 stars 46 forks source link

noise: Add 3D Perlin Noise to noise module #163

Closed ulises-jeremias closed 6 months ago

ulises-jeremias commented 1 year ago

Describe the feature

Add a 3D perlin noise implementation to vsl.noise

Use Case

Perlin noise is a procedural texture primitive, a type of gradient noise used by visual effects artists to increase the appearance of realism in computer graphics. The function has a pseudo-random appearance, yet all of its visual details are the same size.

We already have a 2D implementation of the Perlin Noise, so the scope of this is to have a new 3D implementation as well

Proposed Solution

Other Information

-

Acknowledgements

Version used

-

Environment details (OS name and version, etc.)

-

prithvidasgupta commented 7 months ago

@ulises-jeremias I was working on the 3d noise generation today (just trying out VLang). I think there is a bug on https://github.com/vlang/vsl/blob/02221fde8ed188bdc7e25f9b8df4aea961837edc/noise/perlin.v#L33

shouldn't it be sy := y - f32(y1) ? Or is my understanding incorrect?

ulises-jeremias commented 7 months ago

just in case I'll include @boonsboos on this conversation because he was the creator of that module 😊 in any case, I'll take a look later just to confirm!

prithvidasgupta commented 7 months ago

@ulises-jeremias should i just port Perlin's original implementation to vlang/vsl? https://mrl.cs.nyu.edu/~perlin/noise/

PottierLoic commented 6 months ago

Hello i just compared a basic noise function (random value everywhere, no perlin or other stuffs) and the 2d perlin noise from vsl.

basic noise here noise_basic

and actual 2d perlin noise here noise_perlin

Perlin noise should be way smoother so I made another implementation based on this https://adrianb.io/2014/08/09/perlinnoise.html and it looks like this :

new_perlin (The little glitch on the bottom is only caused by the screenshot)

Can I try to submit a PR for 2d and 3d perlin ?

ulises-jeremias commented 6 months ago

@PottierLoic sure! Go for it!