joeiddon / perlin

A JavaScript library for Perlin Noise generation
111 stars 22 forks source link

How can this be extended to be used in 3D Graphics? #1

Open knightcube opened 3 years ago

knightcube commented 3 years ago

I am using three.js to create dynamic geometries using this tutorial.

I tried replacing the following two lines of code

var value = noise.perlin2(x, y);
var value = noise.perlin3(x, y, z);

with this,

var value = perlin.get(x,y)

But it would be great if I could add a z property too

obscuredc commented 7 months ago

I know it's been 2+ years, but for anybody else: I bet you could edit the current code by following wikipedia's guide to creating the algorithm and using the preexisting dot_prod and smootherstep functions to extend the function to include a z component edit: specifically, here:

...using a three-dimensional approach by interpolating between 8 corners of a cube instead of the 4 corners of a square below.