Can someone explain (in small words please) what the inoise function does?

(Bruce N) #1

Can someone explain (in small words please) what the inoise function does? I get that it is “fixed point implementation of perlin’s Simplex Noise” but WHAT DOES IT DO???

I am looking at some sample code that uses FastLED to simulate a flame and it has this line of code:

// get one noise value out of a moving noise space
uint16_t ctrl1 = inoise16(11 * millis(), 0, 0);

I don’t even understand what a moving noise space is let alone what the purpose of this function is. I understand that is creating some kind of randomized number but the context is completely lost on me. Can someone provide an analogy that does not require a physics degree to understand?

(Andrew Tuline) #2

I think of it as a function that can create a 3D landscape or a cloud. You would then call the noise function to determine the values at each location, which you can use to create these ‘cloudlike’ effects:

In my case, I grab 1D values from the noise function and do this:

(Andrew Tuline) #3

Oh, and as a quick followup, a while back I took that noise routine, crudely weighted the values and made a very short fire routine with it:

(Dougal Campbell) #4

There are some pretty good articles that explain Perlin Noise and its uses. Some good examples of use are generating marble or cloud textures in raytracing.

Basically, it’s an algorithm that generates values that are overall pseudo-random, but locally related.

Okay, wait, what does that mean? In means that if you give it input values that are far apart, the output will be relatively more random, but inputs close together will generate outputs that are also closer together.

Imagine you have a lava lamp, and let’s say it’s a big one, that makes lots and lots of floating balls. If you take a picture, then come back 5 minutes later and take another picture, they will appear very different. In that 5 minutes, various balls of goop will have floated upwards, downwards, and around, balls will have merged and split, etc. It will be a completely different environment.

But if you took pictures 5 seconds apart, things will have moved less. You will be able to identify some of the shifts. If you take pictures 1 second apart, even less will have changed. There’s still lots of random variation overall, but the smaller your time increment, the less randomness there is between frames.

That’s kind of what the noise function does.