PDA

View Full Version : 3D noise


-Vormav-
06-16-2005, 02:59 AM
Yep. Another shader question.
I think I understand the basic idea behind 3d noise: Create a static table with random values at either random or preset points. From there on, you can just use linear interpolation for all of the other shading points. And of course, to get more variation you can apply different 'levles' of noise, or more directly a higher number of pre-calculated points to interpolate from. And if that's not enough, a little bit of turbulance to give it even more variety.

What I don't understand is how to deal with points that would go beyond the scope of your pre-calculated table. Obviously you're not just going to tile the thing. How exactly would those points be handled?

Enki[Mute]
06-17-2005, 01:26 PM
Yep. Another shader question.
I think I understand the basic idea behind 3d noise: Create a static table with random values at either random or preset points. From there on, you can just use linear interpolation for all of the other shading points. And of course, to get more variation you can apply different 'levles' of noise, or more directly a higher number of pre-calculated points to interpolate from. And if that's not enough, a little bit of turbulance to give it even more variety.

What I don't understand is how to deal with points that would go beyond the scope of your pre-calculated table. Obviously you're not just going to tile the thing. How exactly would those points be handled?

Hey vormav,

you got it all right .. only .. you don't use different 'levels' (properly called octaves)
just to get more variation. You use different octaves to make sure you don't see the
wrapping :) ..

I guess that answers your question .. you should simply make sure that any point you
will sample fits in the base octave .. if you encounter any points outside of the base
.. change your scale ..

grtz.
e.

shadowMaster
06-29-2005, 05:46 PM
']Hey vormav,

you got it all right .. only .. you don't use different 'levels' (properly called octaves)
just to get more variation. You use different octaves to make sure you don't see the
wrapping :) ..

I guess that answers your question .. you should simply make sure that any point you
will sample fits in the base octave .. if you encounter any points outside of the base
.. change your scale ..

grtz.
e.


Erm, almost...

The octaves are really just to give you better, more turbulent, noise with a wide range of frequencies. Often noise with a single frequency is called 'noise' and noise with multiple octaves is called 'turbulence'.

The way that visible tiling is avoided is really by using a good index (hash) function into your (small) table of numbers. You *don't* use a direct lookup with a mod on your x,y,z coords, that will definitely yield visible tiling.

Also, you probably don't want linear interpolation either, that will give not so nice looking noise. Original Perlin noise used a cubic interpolator, I believe, and his newer slightly better, slightly faster noise uses an order 5 interpolation.

Studying this code carefully can explain a lot: http://mrl.nyu.edu/~perlin/noise/

CGTalk Moderation
06-29-2005, 05:46 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.