0

Recently I just finished a program which makes a plane image using perlin noise. Now I want to make that image a cubemap image.

Perlin noise image

This because I want to apply it to a planet (which was made from a cube). I have been trying to generate this cubemap, but there are a lot of discontinuities on the image. Do you know any way to generate this cubemap without these "gaps"? Thank you in advance.

My cubemap

I am using the Javascript library P5.js

Pikalek
  • 12,372
  • 5
  • 43
  • 51

1 Answers1

2

DMGregory's comment is correct in that the proper and canonical solution is to use 3D noise. If you get the coordinates of each cube face in 3D space, you can iterate over them and sample the noise in such a way that the the cube faces connect naturally. Be sure to transform the cube coordinates to what they would be on the actual sphere you're mapping to, e.g. by normalizing the vector from the center.

Additionally, please note:

  • There are many noise algorithms out there. Perlin is only one such, and it's an older one with significant square alignment problems. We would do best to move past counting unmitigated Perlin noise as default, and to also do our due-diligence to address this when answering queries framed around unmitigated Perlin.
  • P5.js noise isn't even Perlin -- it's the further artifact-prone "Value noise" algorithm with fractal summation built in. My first step when using noise in P5 would always be to import an external library.

I recommend the JS port of FastNoiseLite, with one of the Simplex-type options. Disclosure: I contributed substantially to this library's development.

KdotJPG
  • 319
  • 1
  • 7