Skip to main content
GameDev.net gamedev.net
🔒 Locked

Perlin Noise

Started by okonomiyaki May 27, 2002 at 11:27 AM 13 replies 1.1k views
Original Post
okonomiyaki
okonomiyaki
I''ve read a few things online about it, and I also read most of that sky rendering thread where Yann discusses it a little bit, but I never could find a place that discusses really the basic mathematical concept of Perlin Noise. I know the basic concept of what it is, what it does, why it adds certain octaves and such.. so you don''t have to explain what it is, but perhaps in simple mathematical terms. Everywhere I look, the writer explains the concepts and then spits out random mathematical equations. Could someone possibly clarify the mathematics behind Perlin Noise? I know it''s a seeded random number, but I just am not exactly grasping the connection between the math and producing an image. I dunno, I''m just kind of confused on it all Just a little explanation would help.. Yann''s clouds really made me want to learn Perlin Noise..
Big Sassy
Big Sassy
You can also look at this site. It has a lot of articles on different stuff like that. You''ll have to dig around a little thought. It''s not too far from the main page.

***********************
          
Yann L
Yann L
quote:

You can also look at this site. It has a lot of articles on different stuff like that. You''ll have to dig around a little thought. It''s not too far from the main page.


It''s here, to be precise.
felonius
felonius
If you want, I can mail you the original article by Perlin that concerns noise. It is a 11.5 MB PDF file.

(Note: It is an ACM article and therefore legal to redistribute on the net as long as it is not publicly replublished or done commercially.)
Jacob Marner, M.Sc.Console Programmer, Deadline Games
okonomiyaki
okonomiyaki
I had found that talk by Perlin It went a little too fast for me though Thanks for that other page though, it has some really good stuff.

(edit: wow! I'd be grateful if you could mail that to me, it shouldn't be too slow for me to download. Thanks!)

[edited by - okonomiyaki on May 27, 2002 1:58:51 PM]
felonius
felonius
>> wow! I''d be grateful if you could mail that to me, it shouldn''t be too slow for me to download. Thanks!)

Done. you should have it now.
Jacob Marner, M.Sc.Console Programmer, Deadline Games
okonomiyaki
okonomiyaki
Great!! Thanks again, I got it in working condition.
felonius
felonius
That was odd, I just got two of the files back with a message that your mail box was full. How could you have gotten them?

Anyway, let me use this moment to encourage people here to join the ACM (www.acm.org). They have a very large database of articles available in full text for member including all SIGGRAPH proceedings and articles (and 40+ journals for that matter).
Jacob Marner, M.Sc.Console Programmer, Deadline Games
zin
zin
I want to mention one insight I had from reading several perlin noise articles. This insight has little to do with multiple octave noise, it has more to do with just using/interpolating a single octave/table of random values (and therefore possibly not even "perlin" noise per se in the sense of multiple overlapping octaves of noise).

Since we have a table of a number of random values (or a system which generates repeatable random numbers on the fly), indexed by the integer component "m" of the argument value "m.n" and some mechanism to extract a fractional value by interpolating between adjacent random numbers using the "n" component, this is my insight:

Lets say we want to randomly animate a head, simulating a character looking to the left and right over a range of +-45 degrees) in a random fashion. And lets say we want the head to move to a new random location approx. once per second.

This means that all we need is to use a command like headAngle=perlin(timeSeconds)*45; Perlin normally yields a value ranging from -1 to +1, which we multiply by 45 to get the +-45 degree tilt. And since we feed it an argument whose integer component oncreases by 1 each second (timeSeconds), we therefore know that we will smoothly swing the head to a unique random orientation once per second.

So anywhere that we want seeming random behaviour, of a certain number of discrete sites over a specific period of time, we simply ensure that over the time period involved, we continuously request perlin/table values, and sweep the argument to span n integer units over the time specified.

--------------

As an aside, just as an experiment, I setup a tiny 10 element table of random numbers, and setup a function that takes an argument m.n, and a "channel" number, which through a simple function allows me to start the table extraction at a variable offset (0-9 in this case), and variable steps (+1,+2...+9, -1,-2,...-9, so it doesn''t only use adjacent table values but can sweep through the table in different step sizes and directions), I was able to generate 100''s of unique waveshapes w/ just 10 entries! (of course you would normally use a larger table) Even though some of the channels with a similar stepsize would share the same sequence, they are out of sync, so still look unique when mapped to different things in my world. Some of my apps have alot of random things going on, this allows me to uniquely animate them all with just a small table and a simple function. Independently animating alot of blades of grass for example...

Just a thought.

zin

zintel.com - 3d graphics & more or less
zintel.com - 3d graphics & more or less
Yann L
Yann L
Yes, Perlin noise has lots of applications. And even a single-octave noise is still Perlin noise (a somewhat degenerated version, though), it all depends on the output frequency you need. For a moving head, you''ll need very low frequencies, so using a single octave is absolutely fine.

I also tend to use Perlin noise for almost everything random in our engine: grass and tree-leaf movements, wind strength and direction, the flickering of fire-light, etc. And sometimes, you can use very small random permutation tables, as you mentioned. That speeds the whole thing up, and makes it a very efficient smooth random noise generator.

Thanks Ken

/ Yann
greeneggs
greeneggs
quote:
Original post by Yann L
For a moving head, you'll need very low frequencies, so using a single octave is absolutely fine.



I think you mean a narrow spectrum, not low frequency. With some experience I've been able to figure how to tweak Perlin noise to get desired results, but I have no idea what plain-English terminology for these effects is. For example, what do you call it when, for some fixed number of octaves of noise, you decide to increase the frequency spacing between octaves?

Perlin noise doesn't always work so well, without underlying physical models. For example, pure noisy water looks pretty bad. Perlin noise clouds look like Perlin noise clouds -- not bad, but there is often a "Perlin" look to them. But noise is great for procedural texturing.

A big problem with noise is that it can be hard to tweak. In a noise-based cloud field, for example, it's hard to move clouds around relative to each other, add to clouds, add new clouds, make clouds brighter, et cetera. Clouds might not be the best example; but often you have a noise-based effect of some sort which you want to tweak.

[edited by - greeneggs on May 29, 2002 7:27:12 PM]
Yann L
Yann L
quote:

I think you mean a narrow spectrum, not low frequency. With some experience I''ve been able to figure how to tweak Perlin noise to get desired results, but I have no idea what plain-English terminology for these effects is. For example, what do you call it when, for some fixed number of octaves of noise, you decide to increase the frequency spacing between octaves?


Hmm, don''t know the term for that, but english is not my native language either...

But I actually meant low frequency. If you take a narrow band, then it might still contain high-frequency parts, and that would make his head movements look weird, as if the guy had spasms But you''re right, for most effects (such as flickering fire), you would take a narrow band noise, eg. octave 4 to 6, leaving out 1,2 and 3.

quote:

Perlin noise doesn''t always work so well, without underlying physical models. For example, pure noisy water looks pretty bad. Perlin noise clouds look like Perlin noise clouds -- not bad, but there is often a "Perlin" look to them. But noise is great for procedural texturing.

A big problem with noise is that it can be hard to tweak. In a noise-based cloud field, for example, it''s hard to move clouds around relative to each other, add to clouds, add new clouds, make clouds brighter, et cetera. Clouds might not be the best example; but often you have a noise-based effect of some sort which you want to tweak.


Noise is almost untweakable. And it''s definitely no replacement for accurate physical simulation. Eg. there is no real use for Perlin noise in water simulation. Fourier synthesis works a lot better, together with real physically based simulation, eg. NSE solver.

But lots of effects in nature can be modelled using noise. Even if the underlaying physical model is different, the results can be visually pleasing, at a fraction of the computation time required for an accurate simulation (clouds being the perfect example).

Lots of physical models use noise in an implicit way: as pertubation. Eg. a fluid dynamics simulator for fire or smoke will look boring without a minimum randomness. This can simply be the influence of wind. And Perlin noise is perfectly suited for that sort of thing.

Another good example is the movement of grass. From a distant point of view, this movement is more or less random. Of course, it is really a physical process, but imagine computing the physically accurate movement and collision of millions of grass blades in realtime ! Impossible. Using a noise system, it can be done, and it will look just as good. Other examples include a very primitive AI for flock-systems (birds, butterflies, fish, etc). Here it can be combined with a rule-based AI system to control the flock.

There are more uses for noise as one might imagine at a first glance.

/ Yann
davepermen
davepermen
noise does not solve anything. noise can''t replace any physical approach (except, well.. noise). but it can add realism, as no physical system has EVERYTHING in, so in real, most of the stuff we simulate on pc has sort of noise in, generated by physical details we just dropped. say a 3d vectorfield for the wind. it can be done, but has to be damn lowres today. so while moving the particles in the wind, you can at everytime add some noise to them, so they look more like in a real 3d volumetric air wich fluids around..

about the grass: use a fluid solver in 2d.. looks awesome cool like the flowers in shrek

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
okonomiyaki
okonomiyaki
Well, in a sense, noise does solve something. Just like you said, you add noise to wind or anything of that nature to create a more realistic effect because it adds the natural sense of minute randomness. Therefore, noise solves the problem of rendering realistic effects without heavy processing power.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.