We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › noise function
Page Index Toggle Pages: 1
noise function (Read 689 times)
noise function
Dec 25th, 2009, 4:37pm
 
Hi. I have a question. I want to use the noise function to affect a radial gradient. But the problem is that the zero angle does not have the same value as the 2 PI, so there is "flaw" in the gradient. Does the noise function have a period of some kind, that I can use as scale ? When I plot the perlin noise in 2D I can see repetitions, but I could not find the period...
Re: noise function
Reply #1 - Dec 26th, 2009, 1:32am
 
You need a noise function that returns the same value for 0 and TWO_PI, right? Like cos() or sin() maybe?

Why not something like that :
Code:
float a = 0.0;
for (float x = 0; x < width; x ++) {
 a += 0.01;
 float y = 20*cos(x*0.2)*noise(a);
 point(x, 50 + y);
}

Re: noise function
Reply #2 - Dec 26th, 2009, 9:51am
 
Hi. Thanks for your response. I can see that I was not completly clear in my previous post. I'm goin to try to explain a little bit more. The problem with the cos() and sin() is that they repeat values between O and TWO_PI, and they give very symmetric results (-1,1). I want something that only repeat itself with a TWO_PI period.

To give a little bit more context. This is the example that I'm talking about. openprocessing.org/visuals/?visualID=6684

The sun corona looks very symmetric and not natural, because I could not think of function that only repeat itself with TWO_PI period.

Code:

float d = a > PI ? TWO_PI - a : a;
float value = noise(x*0.05f,y*0.05f,d+timeStep)-start;


The d value should be something that only repeat itself with TWO_PI period. When I plot the noise function in 2D I can see some patterns repeating, so I imagine that the noise function has an internal period of some kind, but I dont know what that is.
Page Index Toggle Pages: 1