Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate Perlin noise on a spherical surface?

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?

like image 851
dlras2 Avatar asked Jul 02 '11 04:07

dlras2


People also ask

What is the algorithm for Perlin noise?

Perlin noise is a popular procedural generation algorithm invented by Ken Perlin. It can be used to generate things like textures and terrain procedurally, meaning without them being manually made by an artist or designer. The algorithm can have 1 or more dimensions, which is basically the number of inputs it gets.

How was Perlin noise created?

History. Ken Perlin developed Perlin noise in 1983 as a result of his frustration with the "machine-like" look of computer-generated imagery (CGI) at the time. He formally described his findings in a SIGGRAPH paper in 1985 called An Image Synthesizer.


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.

like image 124
Argenti Apparatus Avatar answered Oct 06 '22 01:10

Argenti Apparatus


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.

like image 22
Neil G Avatar answered Oct 06 '22 03:10

Neil G