bluewhale
bluewhale

Reputation: 307

Make 3D perlin noise function from 2D function

So, I am trying to plot abstract shapes that change with time using openGL. For that, I want to use the Perlin noise function. This code (http://www.sorgonet.com/linux/noise_textures/) is a just perfect start for me, except for the fact that the function found here takes only two coordinates. I want one that takes two spacial coordinates, and a third one, that will change with time.

My question is: is it possible to adapt this function to work with one more coordinate?

Upvotes: 0

Views: 893

Answers (2)

Kendall Frey
Kendall Frey

Reputation: 44326

Yes, it is possible.

You can treat the time dimension as a spatial dimension without any problems.

For 2D noise, you will use 2D interpolation like this, using bilinear as an example, but the idea should work with bicubic etc.:

First step:

You have 4 outside values, and one point inside them to get the value of.

+    +

  x


+    +

Second step:

Interpolate on the Y axis.

+-+--+

  x


+-+--+

Third step:

Interpolate on the Y axis.

+-+--+
  |
  x
  |
  |
+-+--+

Now we have the interpolated value.

Now, to add an third dimension, we start with 8 values and add an extra step: Interpolate on the Z axis. This will scale to arbitrarily many dimensions.

Upvotes: 1

Monkey
Monkey

Reputation: 1866

What about 3d perlin noise ? http://webstaff.itn.liu.se/~stegu/aqsis/DSOs/DSOnoises.html

Use 2 coordinates for your geometry, one for time.

Upvotes: 0

Related Questions