I am trying to generate terrain using Perlin noise. I understand how to generate it using Cartesian coordinates, but can't quite wrap my head around how it would work on a sphere. I know that you can project 2D surfaces onto spheres, but wouldn't the distortion mess up the noise distribution? The best idea I can come up with for generating uniform noise on the surface of a sphere is to map the point on the sphere to a 3D Cartesian coordinate and use a 3D noise function. (Basically, to generate a cube of noise and "shave away" the corners to make it round, as it were.) Is there a better method I'm missing?
-
FYI, I thought about asking this question on Math though the topic of Perlin noise seemed like a better fit for StackOverflow, but perhaps I was wrong. – dlras2 Jul 02 '11 at 04:15
-
+1 for a very interesting question. I'm not the most familiar with Perlin Noise, but I do have some significant Mathematics background, which would help significantly with the transformation, and will take a look into this. – Zéychin Jul 02 '11 at 07:54
-
@Zéychin - If you'd like to look into the basics of Perlin noise as well, the best explanation I've found is here: http://freespace.virgin.net/hugo.elias/models/m_perlin.htm – dlras2 Jul 02 '11 at 07:57
-
The most important part to remember is that each area of noise interacts with the areas adjacent to it, so distortion or disjoint polygons would be readily visible in the noise. – dlras2 Jul 02 '11 at 07:59
-
1In fact, from the page I linked: "You can also define a 3D texture. You can think of this as a solid block of material, from which you can 'carve' an object. This allows you to produce textures which can be applied to any shaped object without distortion." I'm wondering if there's a better way to do this for spheres, however. – dlras2 Jul 02 '11 at 08:02
2 Answers
I believe the approach is to actually use a 3 dimensional noise field (every point in a 3D space has a scalar noise value) as opposed to a 2 dimensional field (every point on a 2D plane has a noise value).
When using a 2D noise function to generate a height map, you offset the z value according to the noise value.
When using a 3D field, you sample the noise at points on the surface of a sphere, then use the noise value to offset each point radially away from or towards the center of the sphere.
3D noise is harder and slower to produce obviously, but you don't have to deal with the complications of wrapping a surface around the sphere, and because the noise function is continuous there are no seams.
This can obviously be applied to any arbitrary shape.

- 3,857
- 2
- 25
- 35
-
I don't suppose you have an example of this? I'm trying to generate something that represents "the floating islands of pandora" from the movie Avatar as my terrain in a game ... I can't seem to figure this out despite trying! The best I have so far is to generate 2 heightmaps using noise then basically stitch them together (with one inverted) ... such a crappy solution ... would love to see this in action though !!! – War Apr 09 '13 at 18:16
The real puzzle here is how to alter the Perlin noise basis functions (called octaves?), which are defined using frequency and amplitude so that they are over a sphere instead of an n-dimensional plane.
So, we need to have a set of basis functions (given direction, frequency, and amplitude) defined over the sphere. Direction is a point with, say, zero value. For any point on the sphere, you measure the angular distance to the direction vector. You divide the angular distance by the frequency, and calculate the sin of that angle. Finally, you scale by the amplitude.
You can do something a little fancier if you want your basis functions to vary differently in two-dimensions, but you will need a second direction parameter to orient the projection. You will also need to calculate two angular distances. It might be overkill though. If you have a bunch of basis functions, the circular patterns of the algorithm above might completely blur each other out, so I would try the easy solution first.
Using these Perlin noise basis functions, you can now evaluate your Perlin noise over the sphere as the sum of a bunch of these. Whether you decide to tesselate the sphere and evaluate the vertex corners is up to you. That's what I'd do.

- 32,138
- 39
- 156
- 257
-
If I understand you correctly, this will make completely disjoint noise distributions on each polygon, leading to very visible edges, rather than a continuous distribution. – dlras2 Jul 02 '11 at 07:56
-
Why would that be? The vertices on the edge (which are members of the adjoining polygons) have the same randomly-generated intensity in both polygons. Am I missing something? – Neil G Jul 02 '11 at 08:02
-
1I think I'm understanding you a little better, and will have to consider this. It would add complexity, I think, since the polygons would not be regular. – dlras2 Jul 02 '11 at 08:05
-
@Cyclotis: You're right, you don't need to tesselate. Hang on, I'm fixing my solution. – Neil G Jul 02 '11 at 08:10