View Full Version : noise function..

03 March 2003, 10:01 AM
ok guys, what am I doing wrong here, i'm putting this into the alpha gain..

file1.alphaGain = noise (0.04,0.1);

so I want it to vary between 0.04 and 0.1 but when I apply it, it gives it a value of -0.306, what's up with that?

03 March 2003, 10:21 AM
i think noise returns the value from a static noise field (like a 3d texture).. for the same input you always geht the same output..

what you are looking for is
rand(0.04, 0.1)
i think



03 March 2003, 10:43 AM
so I want it to vary between 0.04 and 0.1 but when I apply it, it gives it a value of -0.306,

Noise returns a value from -1 to 1. IŽd recommend checking the expressions docs when youŽre not sure about these things.


03 March 2003, 09:26 PM
Just remember, Perlin noise (as represented in the noise function) and "white" noise, (also known as broad-spectrum noise, represented in the rand function) are NOT the same.

Perlin noise is pretty much low-pass-filtered white noise.

-- Mark

03 March 2003, 04:57 AM
i used the noise function once in an expression. i used it as a way to get around animating an always moving tail on a ghostly figure. i loved it :)


03 March 2003, 06:39 AM
well, I've kindof gotten it working now, I wanted to use the noise fucntion to give a more smooth interpolation between values rather than a rand function, because this is controlling a glow, and I wanted it to oscillate rather than flicker....but I figure it might be easier to key it and then set it to post infinity.... Thanks for the help guys!

03 March 2003, 06:35 PM
If you want some continuity between frames( this is usually desirable ) then use noise. The inputs to noise are coordinates, not ranges, so you need to remap the output of noise ( -1 to 1 ) to your desired range. To animate noise you pass in a changing value into the input coordinates(like walking along a texture).

float $speed = 1.0; // speed of flickering
float $minValue = 0.04;
float $maxValue = 0.1;

file1.alphaGain = (noise( $speed * time )+1.0)*0.5 * ($maxValue-$minValue) + $minValue;

Note that this is only using a one dimensional noise. One can use two or three arguments to the noise function as well for 2 and 3D noises. Typically we use spacial values (x,y,z) or (u,v) as inputs to noises, but one can be creative and use time or other values that vary.


CGTalk Moderation
01 January 2006, 03:00 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.