View Full Version : Understanding the noise command
Hello,
I'm trying to understand the expression in Fluid Effects>Get Fluid Examples> WindTunnelClouds.ma.
This file uses noise( a perlin noise texture ) to set the voxels along the inflow boundary.
I don't quite understand about the "noise" command......
If I created a simple default 2d container (XRes 40, YRes 40, XSize 10, YSize 10, ZSize 0.250) using perlin noise texture, & typed the following in the script editor
float $tellMe = noise (1,1);
print $tellMe; // something like 0.672635 is printed
where the heck did that 0.672635 come from? This is the value of the noise in 1, 1 of the container?
Is 1, 1 the voxel Xindex/Yindex or is the the U, V?
Any input is much appreciated
Fess
|
|
Bonedaddy
11-15-2005, 03:44 PM
Those are just seeds to randomize the value of noise(). Noise is a randomizing function, but it's different from rand() in that if you slightly change the seed value, you're not going to get a completely different number. So were you to put it on, say, the translate of a box, it'd jitter around, whereas if it was rand(), it could easily just jump from one place to another. Noise segues between its highs and lows.
Hey,
Thanks for the explaination,
I see what you mean when saying the noise helps to randomize.
I also see that the "seeds", control the sequence of random numbers generated.
I tried to actually "see" the randomization of the noise being performed with couple of simple expressions:
pCube1.translateY = noise(5,5); // pressed play, nothing happened to the cube.
pCube1.translateY = noise(time); // pressed play, & the cube smoothly bobbed up/down.
Can you advise me on why the 1st expression yielded no results?
Fess
Segmoria
11-16-2005, 02:59 PM
Well, the first expression pCube1.translateY = noise(5,5) does yield a result but is always generating the same value since the noise function is feeded with the same input values and
there is no variation in them between the frames so you see the cube in a static position.
On the other hand, in your second expression pCube1.translateY = noise(time) the time parameter is sent to the noise function and because of the fact that time is a constantly changing variable the noise function generates different values, thus you see an animated cube.
In other words using noise function with same input you always generate the same output.
YourDaftPunk
11-16-2005, 09:04 PM
Here is an example with curves:
float $i;
int $y_min = -5;
int $y_max = 5;
float $noise_y;
float $rand_y;
string $noise_curve = "curve -d 1 -n noiseCurve1";
string $rand_curve = "curve -d 1 -n randCurve1";
for ($i = 0; $i < 10; $i += .04) {
$noise_y = noise($i) * $y_max;
$rand_y = rand($y_min, $y_max) + 10;
$noise_curve = $noise_curve + " -p " + "0" + " " + $noise_y + " " + $i;
$rand_curve = $rand_curve + " -p " + "0" + " " + $rand_y + " " + $i;
}
eval($noise_curve);
eval($rand_curve);
xform -s 1 .5 2 -t 0 3 -10 noiseCurve1;
xform -s 1 .5 2 -t 0 3 -10 randCurve1;
Noise, unlike rand, always produces a value between -1 and 1 so it needs to be scaled. Noise also needs a changing seed. That's why they are used so differently, but this:
$noise_y = noise($i) * $y_max;
$rand_y = rand($y_min, $y_max);
produces results in the same range (noise of course being the smoother result).
Segmoria, YourDaftPunk
Your explaination/examples are much appreciated.
Took me a few days to "get" it.
Happy Thanksgiving
Fess
CGTalk Moderation
11-23-2005, 02:57 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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.