Search code examples
javanoise

Java - Perlin noise that loops


I need to generate textures for 3D planets (spheres) in Java using a perlin noise program I wrote. But the catch is that the left and right need to be the same, also up and down so you can put the texture on a sphere.

I can't put the perlin noise source here because it's too long but it's mostly based on http://devmag.org.za/2009/04/25/perlin-noise/


Solution

  • The way perlin noise works is that it interpolates between values of a grid.

    For this purpose, the simplex noise would be more appropriate (else the noise density won't be the same at the poles, as you can't pave a sphere correctly with squares).

    You will need to divide your sphere in simplexes (triangles in your case), and then for each triangle angle (only once per point), randomize a value.

    Then you can calculate the texture at each point of a triangle by interpolating with the simplex noise method.