Stub for Perlin-like and value noise.
[h2]SECOND PASS[/h2]
This family of noise functions are incredibly useful tools for creating and modifing content. According to CG industry lore it was informally observed in the 90s that &amp;quot;90% of 3D rendering time is spent in shading, and 90% of that time is spent computing Perlin (gradient) noise&amp;quot;. Regardless of the truth of this observation, this family of noise functions are certainly one of the most important techiques not only in proceeduarally generated content but in CG as a whole. Increases in CPU speed and the relatively new addtion of GPU computation allow for using the cheaper of these methods in realtime graphics.
Attempting to give any detailed descriptions of how to &amp;quot;use&amp;quot; noise functions to create or modify content is well beyond the scope of any short description. The goal here is to outline some basics of core generation techniques and to provide links to more detailed information in specific areas of interest.
For the local discussion, we&amp;#039;ll assume that noise accepts floating point input for a sample coordinate and returns a floating point value (normal either on [0,1] or [-1,1]).
......
......
[b]Value noise[/b]
[url=http://en.wikipedia.org/wiki/Value_noise]Value noise[/url] is the one of the original attempts at this style of noise generation. It is very often miscalled Perlin noise. Evaluation is very cheap, but it burden with serious defects and is very poor at band-pass filtering. Quality can be improved, but even the most basic improvements make it more expensive than gradient noise. So a general guidline for using this techique is to only use a very cheap version and only when some exisiting content can be minorly modified by one or two evaluations.
Value noise is computed by forming a regular grid. The most common way is...blah, blah
[code]
float eval(float x, float y)
{
// lower left hand corner of cell containing (x,y)
int ix = (int)Math.floor(x);
int iy = (int)Math.floor(y);
// offset into &amp;#039;cell&amp;#039; of (x,y)
float dx = x - ix;
float dy = y - iy;
// generate a random value for each vertex of the cell
// based on its integer coordinates.
float r00 = mix(ix, iy);
float r01 = mix(ix+1, iy);
float r10 = mix(ix, iy+1);
float r11 = mix(ix+1, iy+1);
// use some interolation techinque to get the sample value.
return lerp(r00,r01,r10,r11,dx,dy);
}
[b]Perlin gradient noise[/b]
First present in 1985 by Ken Perlin, this Oscar award winning technqiue...blah, blah.
[b]Perlin simplex noise[/b]
[b]Others[/b]
[list]
[li]Anisotropic noise[/li]
[li]Gabor noise: not the same family, but can generate similar results.[/li]
[li]Sparse convolution noise[/li]
[li][url=http://en.wikipedia.org/wiki/Wavelet_noise]Wavelet noise[/url][/li]
[/list]
[b]References[/b]
[list]
[li][url=http://graphics.cs.kuleuven.be/publications/LLCDDELPZ10STARPNF/]&amp;quot;State of the Art in Procedural Noise Functions&amp;quot; (2010)[/url][/li][/list]
----
[h2]FIRST PASS[/h2] (snipped)
[b]Theoretical background stuff (that isn&amp;#039;t useless)[/b]
[url=http://en.wikipedia.org/wiki/White_noise]White noise[/url] is like what one hears on a radio tuned to no station. It&amp;#039;s also like old broadcast TVs on a channel with no signal. Generation a 2D texture of white noise is easy..just use any reasonable random number generator and set each pixel to a random value. But white noise isn&amp;#039;t really very useful in creating content. What we really want is to be able to create random numbers, but random numbers that aren&amp;#039;t totally independent of one another. What was want is to approximate a bandpass filtering of white noise. What? you cry! Sadly to explain requires a touch of notions from signal processing.
Some [url=http://en.wikipedia.org/wiki/Joseph_Fourier]dude[/url] figured out that all signals can be exactly recreated by summing up an infinite number of functions. Originally considered were sinusoids (a.k.a sin or cos). A sine or cosine on a given amplitude is a nice pair of spikes in the frequency domain. (umm..forgot I said that if not clear) Here there some nice little [url=http://en.wikipedia.org/wiki/Fourier_series]pictures[/url] of creating a square wave out of sinusoids. Hand-wavingly what you do is add together different (say) sine evaluations of different amplitudes, frequencies and phase shifts: [tt]A[sub]i[/sub] sin(F[sub]i[/sub]x + S[sub]i[/sub])[/tt] to approximate the final signal (you need an infinite number to get it exact).
This is the basic notion behind signal processing. Generally in signal processing you take an existing signal and modify it for compression, some effect or whatever else. In terms of noise we want to do the opposite and procedurally create a signal. Instead of using sin or cosine as our &amp;quot;building block&amp;quot; we&amp;#039;re going to use an approximation of [url=http://en.wikipedia.org/wiki/Band-pass_filter]band-pass filtered[/url] white noise. Roughly the notion of the band-pass filtering is that we want a narrow range of frequencies for our building block so (like in the sin/cos example) we can vary the amplitude, frequency and phase shift of our function and combine some number of them together to create a signal.
Why bring any of this up? It&amp;#039;s simple. The various noise functions all have some defects and additionally some are better at approximating band-pass filtering than others. Additionally they will have different distributions of amplitudes and frequency ranges. This boils down to you can&amp;#039;t easily change between different noise functions as all you&amp;#039;re neat effects would require at least tweaking if not a total rewrite. Now the issue with how good a given function is at band-pass filtering comes into play because (roughly speaking) the better it is at the filter, the less summation (evaluations of noise) is required to create the same complexity. The classic example here is that value-noise is very cheap to evaluate and so many people will use it when they would be better off using a more expensive function which requires less evaluations per sample.
[b]Value noise[/b]
[url=http://en.wikipedia.org/wiki/Value_noise]Value noise[/url] is the one of the original attempts at this style of noise generation. It is very often miscalled Perlin noise. Evaluation is very cheap, but it burden with serious defects and is very poor at band-pass filtering. Quality can be improved, but even the most basic improvements make it more expensive than gradient noise.
[b]Perlin gradient noise[/b]
[b]Perlin simplex noise[/b]
[b]Others[/b]
[list]
[li]Anisotropic noise[/li]
[li]Gabor noise: not the same family, but can generate similar results.[/li]
[li]Sparse convolution noise[/li]
[li][url=http://en.wikipedia.org/wiki/Wavelet_noise]Wavelet noise[/url][/li]
[/list]
[b]References[/b]
[list]
[li][url=http://graphics.cs.kuleuven.be/publications/LLCDDELPZ10STARPNF/]&amp;quot;State of the Art in Procedural Noise Functions&amp;quot; (2010)[/url][/li][/list]

Stub for Perlin-like and value noise.

SECOND PASS

This family of noise functions are incredibly useful tools for creating and modifing content. According to CG industry lore it was informally observed in the 90s that "90% of 3D rendering time is spent in shading, and 90% of that time is spent computing Perlin (gradient) noise". Regardless of the truth of this observation, this family of noise functions are certainly one of the most important techiques not only in proceeduarally generated content but in CG as a whole. Increases in CPU speed and the relatively new addtion of GPU computation allow for using the cheaper of these methods in realtime graphics.

Attempting to give any detailed descriptions of how to "use" noise functions to create or modify content is well beyond the scope of any short description. The goal here is to outline some basics of core generation techniques and to provide links to more detailed information in specific areas of interest.

For the local discussion, we'll assume that noise accepts floating point input for a sample coordinate and returns a floating point value (normal either on [0,1] or [-1,1]).............

Value noiseValue noise is the one of the original attempts at this style of noise generation. It is very often miscalled Perlin noise. Evaluation is very cheap, but it burden with serious defects and is very poor at band-pass filtering. Quality can be improved, but even the most basic improvements make it more expensive than gradient noise. So a general guidline for using this techique is to only use a very cheap version and only when some exisiting content can be minorly modified by one or two evaluations.

Value noise is computed by forming a regular grid. The most common way is...blah, blah

[b]References[/b][list][li][url=http://graphics.cs.kuleuven.be/publications/LLCDDELPZ10STARPNF/]"State of the Art in Procedural Noise Functions" (2010)[/url][/li][/list]

----[h2]FIRSTPASS[/h2] (snipped)

[b]Theoreticalbackgroundstuff (thatisn't useless)[/b][url=http://en.wikipedia.org/wiki/White_noise]White noise[/url] is like what one hears on a radio tuned to no station. It'salsolikeoldbroadcastTVsonachannelwithnosignal. Generationa2Dtextureofwhitenoiseiseasy..justuseanyreasonablerandomnumbergeneratorandseteachpixeltoarandomvalue. Butwhitenoiseisn't really very useful in creating content. What we really want is to be able to create random numbers, but random numbers that aren'ttotallyindependentofoneanother. Whatwaswantistoapproximateabandpassfilteringofwhitenoise. What? youcry! Sadlytoexplainrequiresatouchofnotionsfromsignalprocessing.

Some [url=http://en.wikipedia.org/wiki/Joseph_Fourier]dude[/url] figured out that all signals can be exactly recreated by summing up an infinite number of functions. Originally considered were sinusoids (a.k.a sin or cos). A sine or cosine on a given amplitude is a nice pair of spikes in the frequency domain. (umm..forgot I said that if not clear) Here there some nice little [url=http://en.wikipedia.org/wiki/Fourier_series]pictures[/url] of creating a square wave out of sinusoids. Hand-wavingly what you do is add together different (say) sine evaluations of different amplitudes, frequencies and phase shifts: [tt]A[sub]i[/sub] sin(F[sub]i[/sub]x + S[sub]i[/sub])[/tt] to approximate the final signal (you need an infinite number to get it exact).

Thisisthebasicnotionbehindsignalprocessing. Generallyinsignalprocessingyoutakeanexistingsignalandmodifyitforcompression, someeffectorwhateverelse. Intermsofnoisewewanttodotheoppositeandprocedurallycreateasignal. Insteadofusingsinorcosineasour"building block"we're going to use an approximation of [url=http://en.wikipedia.org/wiki/Band-pass_filter]band-pass filtered[/url] white noise. Roughly the notion of the band-pass filtering is that we want a narrow range of frequencies for our building block so (like in the sin/cos example) we can vary the amplitude, frequency and phase shift of our function and combine some number of them together to create a signal.

I'm getting the general gist of it, but I have to admit I know a thing or 2 about signal processing.But my general feeling about the article is that it kind of covers too many things at once at a purely theoretical level without being very practical.Perhaps you could try targeting it to a developer with a specific need, for example procedural texture generation, hight-map generation, or some other procedural content generation. And then explaining why a certain noise algorithm would make sense in that particular case.

I'm trying to deride your article (in fact I'm very interested in the subject), but I feel it covers too many areas to be useful in just one wiki article.

To someone who knows a bit about signal processing, it raises a number of questions. E.g. did you intend your description of decomposition in terms of basis functions to be broad enough to include Taylor expansion? Would it be worth defining "signal"? Does it make sense to talk about Fourier analysis of non-periodic functions in an introduction to noise?

Someone who doesn't know anything about signal processing is guaranteed to not know what you mean by the frequency domain. They may also pick up on the Gibbs phenomenon in the pictures about creating a square wave, and wonder whether it contradicts what you're saying. And they won't have a clue what "band-pass filtered" means.

I've seen some sensational shaders making use of perlin noise to make some really convincing wood textures, and for scene generation it helps to have a little taste for different ways of producing controlled modulation.

Though it would help if we could arrange the structure a little to be more helpful in some way because this is a very useful topic to be covered.

I'm trying to get better acquainted with using noise in textures right now, grappling with it conceptually, having just had my first working experience with calling Simplex noise to assemble a cloudy texture.

I'm not at all clear that getting into Fourier analysis is helpful. I can see where using 'harmonics' can make the coding neater, and it seems to work well with the mathematics of fractals, but it doesn't seem to be entirely necessary. One can add noise that has energy at frequencies that are unrelated to the base frequency with no problem. Visual textures are not like sound waves, where one deals with the prevalence nodes and anti-nodes and standing waves in the "real world," and the ear and hearing portions of the brain has evolved to make use of data in this form.

So, is it simpler, instead, to describe noise as having components that are at various periods, and not worry about the Fourier analysis, at least, at the "beginner" level? Or are techniques to analyze textures to determine their strongest component frequencies in use and an important part of creating textures?

I'm thinking, for a dimension, given a length L and a value "n" along that length, a "basic" unit of noise might be of length n/L. Since n can go from 0 to L, the result of this fraction is 0 to 1. One can multiply this value by different factors to get different degrees of scaling. Obtaining noise with (n/L * K) will be K times more detailed than noise at n/L.

But we are free to make K whatever we want. K can be a float or double. It doesn't have to be an integer or a progression of integers.

(We might also talk about how to "relate" the periodicity of one type of noise to another via a scaling factor that is applied to the n/L (O to 1) results of the different noise generation techniques? Maybe this is already done?)

Then, there is total latitude with what we do with the output noise values (which range from -1 to 1), whether to sum them or lerp them, or use them in trig functions. It seems wide open, as long as the function results in a legal Color value for a pixel.

(It occurs to me, one could also talk about a more concrete value the periodic nature of noise by finding a number of pixels that corresponds to an average of one swing in the random number. But I think I am getting into fuzzy thinking, as I don't know how to describe a "period" of randomness, and the way in which we relate the numbers to pixels on the screen is so fluid.)

As I said, I'm a beginner with using noise, and am happy to be corrected on any point.

Doing octaves is exactly construction that's obvious in the frequency domain and one reason why I thought this might be useful. I'm thinking about a complete different track that describes as coherent pseudo-random numbers and walking though the historic progression of how they work. Detailed usage is a ton of work and was thinking that provide a bunch of links would be reasonable for a first pass. (plus I'm too lazy to make pictures)

Hmm, when generating textures like clouds and terrain it helps to know a little about the effects of noise colouring, distortion and how it can be fun to mess around with to produce different results.

And thinking back to clouds, isn't the very reason you see clouds down to the low frequency bias, with the overtones creating the fuzziness.

I think it would help to show the differences visually though, or even better yet, produce an app to demonstrate it. I learned a lot just by tweaking my 2d noise generator. This could be the difference between generating really mundane levels or elaborate worlds that feel like they've been really well designed IMO.

I agree with what philfrel said about having components at various periods, and experimentation is key. When I was at uni I remember toying around rending series upon series of sine waves, some directional, some radial, until (*I swear*) it looked like plasma. Of course that wasn't the memorable part, the memorable part was when I made a few small modifications and ... err ... it stopped looking awesome and had to investigate and figure out what on Earth was going on Still don't know how I did it

In terms of good, I think it's key to remember that these random values can be feeding into game behaviour. This could be what gives flavour to your map generation algorithm. The more applicable and relative to games the examples are the more that people will digest and be able to use it.

No doubt experience is all important for creating effects and the theory is of marginal use. My thinking is more geared toward choosing what set of base generators to use. Precomputed effects is easy: improved gradient if you want to quickly bang stuff out based on other peoples work (as pretty much everything is written to gradient noise) and/or simplex noise. The 'better' noise methods are too expensive for fast turn around to be useful IHMO. The trickier part is for runtime generated stuff.

Would love to get some more feedback as to what can be done to make the visualizer I started [http://www.java-gaming.org/topics/simplex-noise-experiments-towards-procedural-generation/27163/view.html] something you'd consider adding as a link on the main page of this wiki.

P.S., I'm seriously looking at "open sourcing" the project on GitHub, making the emphasis more on helping devs write and test a wider range of textures. (Just figured out "perspective" but haven't integrated it yet.)

P.S., I'm seriously looking at "open sourcing" the project on GitHub, making the emphasis more on helping devs write and test a wider range of textures. (Just figured out "perspective" but haven't integrated it yet.)

This is almost always a very good idea! Do this, (I'd be intrested too but mind licensing!)

Hey, it's a wiki...do it yourself! Seriously I was thinking this is getting about as long as is reasonable and that talking about basics of using noise should be on another page and have code-snippets like your tutorial. There no reason why your tool shouldn't be linked from both.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org