Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have been reading about the mathematics behind Perlin noise, a gradient noise function often used in computer graphics, from Ken Perlin's presentation and Matt Zucker's FAQ.

I understand that each grid point, $X$, has a pseudo-random gradient associated with it, $g(X)$ - just a vector of unit length that appears random. When finding the noise value at a point $P$, for each grid point surrounding it, $Q$, the dot product $g(Q) \cdot (P-Q)$ is found. Then these dot products are interpolated to find the noise value at point $P$.

The thing I don't understand, however, is why we use gradients. There is another type of noise function called value noise in which each grid point has a scalar value rather than a gradient. I've seen articles that say gradient noise produces higher quality noise but they don't explain why. I can't seem to visualise how this dot product makes the noise any better quality. What does "quality" even mean here? Why did Ken Perlin decide to use gradients?

share|improve this question
    
A very interesting question. Surely the "true" answer depends on something in human visual function, not merely information-theoretic per se... as in JPEG, for example. I am very much interested in good answers to this question. –  paul garrett Aug 18 '12 at 22:37
1  
"Quality" here mainly refers to the visual aesthetics of the result seen as a texture. You can quantify it a little in terms of the Fourier spectrum (for example, Wikipedia says gradient noise has more energy in higher frequencies), but I think most people just mean "it looks better". –  Rahul Aug 18 '12 at 22:39
    
So now my question is "Why do gradients make noise look better?" –  Joseph Mansfield Aug 18 '12 at 22:45
    
Exactly! "Why do gradients make noise look better?"! :) –  paul garrett Aug 18 '12 at 22:50
    
I think @Rahul's is the best explanation. One could certainly talk about why using a smooth interpolating function in between noise values is a good way to go, but with respect to aesthetics, I'm not sure the attractiveness has a mathematical explanation. BTW, you might be interested in Perlin's discussion here. –  J. M. Aug 19 '12 at 3:25
add comment

3 Answers

The answer is easy and mathematical. Mathematical quality.

With value noise the function has no zero at the point of the value - the lattice point.

If you see the value at the point as gradient, you got a zero of the function there and the gradient defines the tangent in that point.

The advantage is a smooth transition as the first derivative matches the left and the right side of the gradient, leading to a smooth seemingly transition.

With Perlins original polynomial of the 3rd degree, however, the second derivation was not zero, meaning it had a curvature at the lattice point.

Later he introduced the improved Perlin with the polynomial of the 5th degree, with also the second derivative being zero.

With this, the transition over a lattice point is absolutely linear no matter how far you "zoom" in and is always smooth.

share|improve this answer
add comment

This is just my guess.

In short: Gradient noise leads in general to more visual appealing textures because it cuts low frequencies and emphasizes frequencies around and above the grid spacing.

Let's compare a naive value noise procedure with a naive gradient one, for a grayscale image.

Value noise: we paint the points in the grid with random values (white noise) and fill the surrounding pixels by linear interpolation. This will look ugly because (among other things) some of the random grid points will happen to have similar values, and then there will be large spots with nearly uniform color (low frequency). [*] Specifically, the pixel values in the neighborhood of a grid point will be all similar - and so we depend on the other grid points being distinct to have high frequencies... and this will be at most (with luck) of the order of the grid separation.

Gradient noise: we compute a random (uniform, white noise) gradient in each grid point, and compute the values by interpolating the dot products of the gradient with the distances. Consider again what happens in the neighborhoood of a grid point, specifically over a small circumference, disregarding the effect of other distant grid points. It's seen that the computed image value (as a dot product) in this small neighborhood will visit -smoothly but fully- the white-black range. Then, we can expect that the image values will never have uniform spots, i.e., we won't practically have frequencies below that of the grid spacing.

[*] A similar problem arises in halftoning/dithering: it's visually unpleasant to use binary white noise because of the low frequency component; a nicer dithering algorithm, as Floyd-Steinberg, produces instead high frequency ("blue noise").

share|improve this answer
add comment

A layman's answer, from experience in the Libnoise anyways, is that Value noise is not as curved as gradient noise... gradient noise assimilates blobs abit closer to round blob structures, whereas value noise seems to produce many straight edge capsule shaped blobs, and if you do mountains with it in 3d and 2d equation source, you will find many most mountains have some kind of capsule shape or a straight edge on one of their sides. i think if its less quality looking value noise must be abit faster.

In my experience, gradient noise is not perfectly smooth over transitions, at least it isnt a perfectly smooth rounded noise function... i wrote code that measures the smoothness of perlin noise and i found that all the libnoise functions i was using, were equally full of digital noise ( although i didnt know how to tweak the quality settings, was just using default libnoise value and gradient noise).

share|improve this answer
    
This post was edited but in such a way that it said things which ufomorace might not have actually wanted to say. The edited paragraph was as follows. "In my experience, gradient noise is not perfectly smooth over transitions, at least it isnt a perfectly smooth rounded noise function like a sinus curve is perfect, it is more like a slightly pixelated sinus... con.t –  user1729 Sep 23 '13 at 12:55
    
"i wrote code that measures the smoothness of perlin noise to apply shadowing to Perlin mountains and i found that all the libnoise functions i was using, were equally full of digital noise, resulting in increasing shadow artefacts when multiple Perlin noise was multiplied/added together. ( although i didnt know how to tweak the quality settings, was just using default libnoise value and gradient noise)." –  user1729 Sep 23 '13 at 12:56
    
sorry I did not realise I wasn't logged in, I indeed was the one that edited, I wished to qualify that any number of sinuses added together still produces a perfectly smooth curve, however large numbers of simplex and Perlin noise added together, resulted in a curve which was not smooth enough for accurate shadow calculation based on the actual curve tangents. –  comprehensible Sep 23 '13 at 13:20
    
Ah! That changes things! If you edit it when you are not logged in (or have lop rep. as you do) then your edits get vetted. If you are editing your own posts then they do not. So you should edit your own post while you are logged in, and then you can say whatever you want! –  user1729 Sep 23 '13 at 13:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.