Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's faster for 3D? Perlin or Simplex noise?

Okay, there are a lot of comparisons between Perlin and Simplex noise to be found on the web. But I really couldn't find one where there was a simple processing time comparison between both for three dimensions, which is what I am mostly interested in. I've read that popular PDF (and even understood most of it - yay!) but I cannot answer the simple question: Which one is faster for 3D, assuming an optimal implementation?

This stackoverflow question answer suggests that Simplex is a pretty clear winner for my case. Of course, there are other resources claiming the exact opposite.

However, the general statement seems to be that Perlin noise has a complexity of O(2^N), while Simplex has O(N^2). Which for 3D would mean 8 for Perlin and 9 for Simplex. But, on some site I found the statement that Simplex is actually O(N). So what is true here, and what does that really mean for speed in 3D?

I am at a loss here, I'm really mainly interested in 3D application (for random terrain generation including caves) usage, and I cannot find a good answer to the question which one I should use if I want it to be as fast as possible.

So maybe someone can help me here :)

like image 244
TheSHEEEP Avatar asked Oct 05 '12 09:10

TheSHEEEP


People also ask

Is simplex faster than Perlin?

simplex noise looks worse imho, and lots of people think it looks "increasingly bad" in higher dimensions. I'd still recommend it over perlin for most applications, as most won't be using just raw simplex but octaves of it which looks roughly the same as octaves of perlin and is significantly faster for octaves.

Is simplex noise better than Perlin noise?

The advantages of simplex noise over Perlin noise: Simplex noise has lower computational complexity and requires fewer multiplications. Simplex noise scales to higher dimensions (4D, 5D) with much less computational cost: the complexity is. for.

Is Perlin noise seamless?

This is a texture that is not seamless, or tileable: you see the cut. For a cube, a basic 3D Perlin noise can be created by stitching together 2D Perlin noises on the various faces. But this 3D noise is not seamless — we see the cut!


2 Answers

1) http://www.fundza.com/c4serious/noise/perlin/perlin.html
2) http://www.6by9.net/b/2012/02/03/simplex-noise-for-c-and-python

Execution times in "my laptop" for 8M samples of noise using these two implementation: (g++ -O6)

1) 1.389s i.e. 5.7M ops per second 2) 0.607s i.e. 13.2M ops per second

But...

When really, really going for the optimizations, one should study

  • Higher level optimizations (what really is done in each stage: are there alternatives?)
  • Branches
  • Memory patterns
  • Dependencies
  • LUT sizes
  • Individual arithmetic operations needed, their latencies and throughputs
  • exploitable parallelisms using SIMD
  • number of live variables
like image 99
Aki Suihkonen Avatar answered Sep 28 '22 13:09

Aki Suihkonen


Simplex noise is better looking, but not necessarily faster. It all depends on the implementation. As a rule of thumb, it is "about the same speed", and there shouldn't be a big penalty from using either variant if your code is good.

Note that most of the code I have written that is floating around on the Internet is not optimized for speed, but written for clarity. The GLSL implementations by Ian McEwan and myself from a couple of years ago are reasonably optimized for speed, but they were optimized for hardware which is now outdated, and the versions of GLSL that were current at the time. Important changes to GLSL since then include integer types and bit-wise logical operations, which makes some of the hash functions awkward and unnecessarily complicated,. The need for a permutation polynomial was motivated by the lack of bit-wise logic operators in GLSL. It's still lacking in GLSL for WebGL, but all other platforms now have integer support.

Simplex noise in 4D is mostly faster than classic noise in 4D. All other cases depend on the language, the platform and the amount of code optimization.

Simplex noise has a simple analytic derivative. Classic noise is more tricky in that respect. In many cases, like antialiasing and terrain mapping, an analytic derivative is very useful.

like image 24
Stefan Gustavson Avatar answered Sep 28 '22 12:09

Stefan Gustavson