Search code examples
algorithm3dperlin-noiseprocedural-generationsimplex-noise

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 :)


Solution

  • 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