Talk:Perlin noise

Latest comment: 4 days ago by WikiDan61 in topic Implementation

1D version should not normalize gradients

edit

Regarding: Define an n-dimensional grid. At each point on the grid (node) assign a random gradient vector of unit length in n dimensions. For a one-dimensional grid each node will be assigned either +1 or -1.

See: (http://mrl.nyu.edu/~perlin/doc/oscar.html#noise), specifically:

for (i = 0 ; i < B ; i++) {
	p[i] = i;
	g1[i] = (float)((random() % (B + B)) - B) / B;
	for (j = 0 ; j < 2 ; j++)
		g2[i][j] = (float)((random() % (B + B)) - B) / B;
	normalize2(g2[i]);
	for (j = 0 ; j < 3 ; j++)
		g3[i][j] = (float)((random() % (B + B)) - B) / B;
	normalize3(g3[i]);
}

In the 2D and 3D cases, the gradients are normalized. In the 1D case, it's simply bounded between -1 and 1.

Beyond not being in the original source, the noise simply doesn't look like noise with normalized 1D gradients. It's very (and unsurprisingly) regular. — Preceding unsigned comment added by 173.174.71.239 (talk) 17:17, 31 July 2016 (UTC)Reply

Common mistakes

edit

These mistakes were found in this Wikipedia article:

1) Hugo Elias' article (http://www.arendpeter.com/Perlin_Noise.html) is on VALUE NOISE, not GRADIENT NOISE (Perlin Noise is gradient noise, not value noise.)

2) Perlin Noise is not white noise. A single "layer" of Perlin noise (or value noise, or any type of noise, there are many)has only one frequency, not all of them. You much blend together many "layers" of Perlin noise to collaborate various frequencies together in one noise (known as spectral synthesis).

Just been pedantic here, but the wording is wrong here. Perlin noise _does_ have all frequencies. What you mean is that Perlin noise is a primitive and contains a single _scale_. Unless you create a single sine wave pattern, all patterns will have _all_ frequencies. You are right that people often confuse the noise primitive (be it Perlin or some other gradient or even value noise) with the FBM (fractal brownian motion) construction and derivatives, and that several layers or octaves (of smaller scales) are needed to create a more rich spectrum (usually of the form 1/f or 1/f^2). But yeah, the two instances of "frequencies" in this paragraph are wrong and should be "scale" — Preceding unsigned comment added by Inigo.quilez (talkcontribs) 18:25, 29 December 2016 (UTC)Reply

3) Perlin Noise is not multiple layers of noise blending together. This is a common misconception. (Even the picture of Perlin noise in this article clearly is created out of only one layer of noise.) This is a mistake commonly expressed on most websites that deal with Perlin noise, even Hugo's article (the #1 result in Google for perlin noise: http://www.google.com/search?q=perlin+noise), but anyone who has examined Ken Perlin's work, especially his original source and numerous examples, you will see no sign of spectral synthesis (adding of multiple frequency layers together). Spectral synthesis is a useful way to use Perlin noise, it is not a defining characteristic of it.

I fixed these mistakes, but perhaps did not make them clear enough.

I am going to write an article on this soon. When I do, I will update this Wikipedia page and link to my article. 24.222.121.193 15:29, 19 July 2006 (UTC)Reply

I'd just like to offer a little encouragement on that new article. This wonderful topic is sadly neglected. 210.9.15.113 09:08, 19 October 2006 (UTC)Reply
Thank you. I will soon... but it is quite a project in of itself :S 24.215.121.195 (talk) 18:47, 19 March 2008 (UTC)Reply
If I understand the third point above correctly, I have to disagree. Ken Perlin's articles talk about generating procedural textures out of single frequencies of a "controlled random primitive" (the image depicted in the article). I don't think the "primitive" is to be interpretted as Perlin noise as it is too simple. Anybody can generate this sort of isotropic random noise. It is completely valid to interpret Perlin Noise as multiple layers as I demonstrate in the article I wrote here (http://dunnbypaul.net/perlin/). This is mathematically identical (though procedurally, quite different) to the algorithm found here (http://mrl.nyu.edu/~perlin/doc/oscar.html). Perlin Noise is in fact a "procedural texture" that can also be interpretted as the recursive algorithm demonstrated there.

Furthermore, in the second citation I offered, Ken Perlin himself says "Hugo Elias has a nice web page about it" at (http://freespace.virgin.net/hugo.elias/models/m_perlin.htm), the same web page that is claimed NOT to be about Perlin Noise in point 1 above. 198.53.229.242 09:03, 12 January 2007 (UTC)Reply

Ken Perlin's comment is that the page is a nice web page about noise based textures. It does not use the same noise generation technique that Perlin invented. There seems to be some confusion over whether "Perlin Noise" refers to the specific noise generation algorithm that Perlin invented or to noise-based textures in general which Perlin's work popularized.--Vorpy 21:40, 18 February 2007 (UTC)Reply
There is HUGE confusion over this. One fact is that Ken Perlin's original noise is gradient noise, not value noise, based on interpolation of gradients not interpolation on (final) values. What is Perlin noise? Who really knows? In my planned article, after working and researching it for years, I was actually going to attempt to define it myself once and for all, as Ken Perlin has not bothered to make it clear. This is a common problem with definition of words, is that common usage often dictates it, whereas common usage of Perlin noise is generally spectral-synthesized gradient noise AND spectral-synthesized value noise! The stance I took is that Perlin noise is a single layer of gradient noise, as that's what he original code generates, and everything else is a derivative of that. 24.215.121.195 (talk) 18:54, 19 March 2008 (UTC)Reply
I've altered the link description... the link should be moved to the new article when it is written SiegeLord (talk) 06:24, 27 July 2008 (UTC)Reply
I made the stubs for Value noise,Gradient noise. If anyone wants to expand them, be my guest. SiegeLord (talk) 07:12, 27 July 2008 (UTC)Reply
A year late with this response... This common misunderstanding is Ken Perlin's fault, shame on him for linking to a VALUE NOISE article when GRADIENT NOISE (aka perlin noise) is so much better, they should not be compared as examples of one another. Do the research before making assumptions based on Ken Perlin's links, and even words, as they are very misleading. As the inventor of this technology, he really should take the time to explain it better, and clear this confusion. Again, I may make an article to clarify all of this, but do the research before making assumptions. If you have not coded value noise and gradient noise AND reversed engineered Ken Perlin's code (which you basically have to do to understand it) as I have, you will more than likely be wrong with your opinion. Sorry. Any questions you have on the matter I can answer, I have worked with and coded various noises for years now. 24.215.121.195 (talk) 18:46, 19 March 2008 (UTC)Reply

another inaccuracy: The Article states perlin noise was first used in the movie Tron, but Ken Perlin's slideshow linked to from this article states that he first "started thinking" about noise while working on Tron as a way to get away from its machinelike look. —The preceding unsigned comment was added by 24.41.50.36 (talkcontribs) 17:19, 3 December 2006 (UTC).Reply

Indeed, article on Ken Perlin states that Perlin Noise was created in 1985, whereas this article states that KP was given an award for the work on Tron in 1982. —Preceding unsigned comment added by 98.207.207.199 (talk) 06:43, 13 April 2011 (UTC)Reply

I'd like to point out that there are two (or three) definitions of perlin noise, which slighty differ from each other (although boths author is Ken Perlin himself): Firstly there is his paper An Image Synthesizer[1] which states on page 289: map each ordered sequence of three integers into an uncorrelated ordered sequence of four real numbers: [a,b,c,d] = H([x,y,z]), where [a,b,c,d] define a linear equation with gradient [a,b,c] and value d at [x,y,z] and if [x,y,z] is on the integer lattice, we define Noise([x,y,z]) = d_[x,y,z]. This paper does NOT specifically mention that the value d has to be 0 if [x,y,z] is on the integer lattice. This effectively makes it both a gradient AND a value noise function. Secondly there is the book Texturing and Modeling[2] which on page 76 uses the smoothstep function 3*x^2-2x^3 which is the result from above statements with the assumption that the value d IS 0 on integer lattice points. This is pure gradient perlin noise! Thirdly there is the paper Improving Noise[3] which replaces the above smoothstep function with a new function 6t^5-15t^4+10t^3, which again is the result under the condition that the value d IS 0 on integer lattice points. pure gradient perlin noise again! This explains the confusion in my opinion, the original paper is not specifically gradient noise, although its still a valid explanation. In my opinion the article should reflect the different papers, because there is quite a difference for the implementation of the function, for example the gradient vectors in Improved Noise are NOT unitlength, other than stated in this wiki article under algorithm.2A02:908:5A0:7CA0:7D0F:30BE:939B:8D70 (talk) 17:30, 1 December 2015 (UTC)Reply

References

Algorithm

edit

This article needs a clear description of the algorithm, preferably compatible with the 2002 version. Also, why is this categorized as a physics article? Seems a lot more like computer science to me. Shinobu 19:03, 10 March 2007 (UTC)Reply

There are parts of the algorithm explanation that I don't understand. Just a list of questions I have:

In the second paragraph under "Grid definition" it says "Acquired gradient are then renormalized." What does it mean to renormalize something? In the next paragraph: "...some implementations use a hash and lookup table..." I think it refers to the data lookup function, but I'm not sure which article should be linked to.

Under Dot product: First paragraph "For each grid node/coordinate a distance vector between the particular point and the node coordinate is determined...." What's a distance vector? It doesn't have its own article. Also, the definition of Dot Product according to its own article seems to require only one input and two distinct sequences of numbers, and I don't understand either article.

That's as far as I've gotten. I hope this will help improve the readability. 72.95.45.209 (talk) 01:05, 24 February 2015 (UTC)Reply

Minecraft reference

edit

From the article: ""Minecraft uses Perlin noise as part of its procedural landscape generation.[2]""

This may be true, but what is the point? Perlin noise is used everywhere not just in minecraft. Should this be removed? -- (fededevi) 193.205.206.25 (talk) 15:11, 30 May 2011 (UTC)Reply

Added some reference to another game. I think it can give an idea of what the uses of a noise generator can be. --87.8.5.219 (talk) 12:53, 22 July 2011 (UTC)Reply

I also think this makes no sense. When adding Minetest, you should also add Manic Digger and FreeMiner.Net. If moving away from MC, then you'd also have to add any other game that uses Noise. I think that this should be removed altogether.188.195.209.75 (talk) 14:41, 17 August 2011 (UTC)Reply

The complete sentence:

"It is also frequently used to generate textures when memory is extremely limited, such as in demos, and is increasingly finding use in Graphics Processing Units for real-time graphics in computer games. For :example, Minecraft[1] and Minetest[2] both use Perlin noise as part of their procedural landscape generation."

"For example"? How does procedural landscape generation relate to *texture* generation and real-time *graphics* in computer games? As much as I love Minecraft, I don't think it's entirely relevant in this context. Now, okay, it *does* use the algorithm, but it is by no means unique in that. Also, using Perlin noise to generate terrain data is not only about games; take for example Terragen. Ddegirmenci (talk) 22:30, 21 October 2011 (UTC)Reply

I split the Minecraft/Minetest reference into a separate paragraph. Terrain generation is a use for Perlin noise, and so seems correct to list in the "Uses" section. I'll leave deciding which games should be referenced to more experienced editors. --81.159.167.165 (talk) 00:20, 21 December 2011 (UTC)Reply

I think that Minecraft is relevant in terms of Perlin noise in popular culture. I do appreciate the technical emphasis on this page, but I do think there is some educational value in pointing out one of the more culturally prominent applications of it. See:
https://www.youtube.com/watch?v=ob3VwY4JyzE&ab_channel=Jfokus Nigels (talk) 04:06, 31 August 2023 (UTC)Reply

Pseudocode Interpolation Issue

edit

Trying to implement Perlin Noise according to the pseudo given, I got stuck with rather unpleasing results. Further investigation revealed rather sharp looking edges in generated images are the result of linear interpolation. Ideally at least the second derivative of the interpolation function should be zero to get pleasing results.

I didn't get my hands on the original paper, so I couldn't verify, but at least [1] suggests using the function   for interpolation. Using this function I finally managed to get pleasing results.

Thus I would like to suggest editing the pseudocode given to contain the following changes.

Add a function fade() evaluating the given interpolation function.


   function fade(float t) {
      return t * t * t * (t * (t * 6 - 15) + 10);
   }

Modify the function lerp() to take our interpolation function into account.

   function lerp(float a0, float a1, float w) {
       return fade(1.0 - w)*a0 + fade(w)*a1;
   }

In case you are unsure weather the suggested edit is justified, Python Code to reproduce a) the unpleasing result of the original algorithm and b) the modified version could be given to verify the difference of results.

Just drop me a line if you are in need of it. --Mikyra (talk) 08:56, 23 July 2017 (UTC)Reply

Stumbled over the same problem. The section above also states that interpolation should be done with a smooth function (zero derivative at the boundaries), not linearly. O.mangold (talk) 10:26, 3 December 2018 (UTC)Reply

Code pointless?

edit

There isn't much point in having the code if you are going to leave the extern in there. It is just like skipping an entire section of code. — Preceding unsigned comment added by Bofum (talkcontribs) 00:56, 23 May 2018 (UTC)Reply

Misuse of term 'Monte Carlo simulation"

edit

Ken Perlin said himself that he used a Monte Carlo simulation in order to generate the random gradient in the hyper-sphere. I think Ken Perlin was wrong. What he used is not a Monte Carlo simulation. Can it be corrected in the article? — Preceding unsigned comment added by 176.180.104.164 (talk) 16:24, 23 August 2018 (UTC)Reply

More Examples Needed

edit

It might be nice to highlight some additional examples also included in the Perlin Noise presentation given by Ken Perlin (http://web.archive.org/web/20071008162042/http://www.noisemachine.com/talk1/index.html) to help show the significance and impact of the algorithm in computer graphics.

Multiple patterns generated and compared: http://web.archive.org/web/20071008170106im_/http://www.noisemachine.com/talk1/imgs/elements.jpg

Fire animation: http://web.archive.org/web/20071008170528im_/http://www.noisemachine.com/talk1/imgs/flame500.gif

Cloud animation: http://web.archive.org/web/20071008170627im_/http://www.noisemachine.com/talk1/imgs/clouds500.gif — Preceding unsigned comment added by 192.55.54.42 (talk) 23:54, 4 December 2018 (UTC)Reply

Broken Code in the example

edit

First: In perlin (x, y) supposedly admits the coordinates in pixels, so it does not make sense to round an integer when it is already an integer. If you want to calculate between your intermediate values ​​you need two more values ​​that indicate the scale used.

Second: Inside the dotGridGradient, the Gradient value is multiplied proportional to the distance. So if the distance in both axes is zero the result will always be zero.

Third: In dotGridGradient and lerp the Gradient formula is applied 2 times. — Preceding unsigned comment added by Rmbeer (talkcontribs) 22:40, 21 January 2019 (UTC)Reply

I don't see why it would be assumed perlin (x, y) is necessarily expecting pixel coordinates? In this implementation it looks like it's the responsibility of the calling code to perform the scaling e.g. perlin(pixelX * 0.05, pixelY * 0.05).
While what you say in your second point is true, is this not simply an aspect of how the algorithm is defined? True, you are left with a black texture if you attempt to render perlin (x, y) directly without scaling, but the whole point unless I am mistaken is you do scale, you shouldn't be sampling at the corner points (integer coordinates) themselves.
I do not see how lerp is being applied twice.
One thing I think is important to note about this code, is the perlin function is returning results in the range [-1, 1]. Perhaps that's how it's defined, and again it's the responsibility of the calling code to not only perform scaling for the coordinate input, but also to map the output to the range [0, 255] for rendering (creating something like the example image shown). Perhaps somewhere the distinction should be made between the code and its arguments / return value, and how it would be utilized in creating grayscale images that I think everyone associates with 'perlin noise'.
TatteredTsundoku (talk) 05:44, 7 November 2021 (UTC)Reply

Unnecessary special case

edit

In Algorithm detail >> Grid definition, there's this sentence:

Define an n-dimensional grid where each point has a random n-dimensional unit-length gradient vector, except in the one dimensional case where the gradients are random scalars between -1 and 1.

The second part seems redundant to me, since in 1D, there are two unit vectors (-1, +1)[1], so this is no special case. Is it some jargon or should it be shortened? — Preceding unsigned comment added by Martin Brajer (talkcontribs) 18:21, 17 October 2020 (UTC)Reply

Answer: I think that extra part is not redundant because random scalars between -1 and 1 include scalars such as 0.751 but the two unit vectors (-1) and (+1) do not include 0.751 — Preceding unsigned comment added by 82.30.5.207 (talk) 18:23, 27 October 2020 (UTC)Reply

Time complexity

edit

What is the time complexity of Perlin noise? This page and Simplex noise seem to contradict each other, with the simplex page saying   and this page saying  . ProletariatetsBefrielseOrkester (talk) 16:28, 10 February 2021 (UTC)Reply

Academy Award for Technical Achievement

edit

Was it 1996 Academy_Award_for_Technical_Achievement or 1997 as stated on Ken Perlin's own page? www.cinemasight.com also suggests the correct year is 1996.

Broken source

edit

The first source is broken (I don't know how to delete this)

Implementation

edit

Two users (Voltdye in July 2024 and Milesroyeet today (November 2024)). Both removals were reverted. I would argue that the removal of this section is warranted, as it appears to be entirely original research. The code that is presented is claimed not to match Perlin's reference implementation, so what is the point? Without citation, and without similarity to Perlin's implementation, we have no way of knowing whether this is a valid representation of the algorithm or not. WikiDan61ChatMe!ReadMe!! 20:05, 14 November 2024 (UTC)Reply