Hacker News new | past | comments | ask | show | jobs | submit login
Perlin vs. Simplex (bit-101.com)
132 points by ingve 11 days ago | hide | past | favorite | 32 comments





I think part of the reason Simplex noise isn't used more is a chilling effect created by this patent https://patents.google.com/patent/US6867776

The owner also goes around suing people regularly: https://insight.rpxcorp.com/entity/1308032-wsou-investments-.... Thus you definitely do not want to touch that technology in a commercial product.

Although it does seem like it expires next year. Sweet!


Sounds like a good theme for a Patent Expiration Hackathon!

A great project would be to upgrade the Blender Noise Texture Node, by adding a Perlin/Simplex switch:

https://docs.blender.org/manual/en/latest/render/shader_node...


I decided once on a whim/as as adventure to try get a license to use that patent - it's currently owned by Nokia, but they never replied to my inquiry.

Also, Simplex noise is good in some ways but for texture -generation, when I tried it by swapping it in, it had a bunch of artefacts that weren't present with Perlin noise - it's not a simple improvement on Perlin.


In the meantime, you can probably use Open Simplex Noise instead: https://en.wikipedia.org/wiki/OpenSimplex_noise


Due to expire next year! I wonder if we're going to see existing projects swap out existing noise generators for simplex, or if it's mostly going to be for new projects. Guessing it's probably going to be the latter.

The problem is that simplex noise has a different look than perlin noise so it's not a drop in replacement. The article mentioned the higher frequency, but IMO it also has a bit more noticeable "spikes".

One thing the article only brushed, but is the main advantage of simplex noise is its performance. Perlin noise scales O(2^n) with the number of dimensions, but simplex noise scales O(n). That's because Perlin noise interpolates the nearest 2^n gradient values in its hypercube neighborhood, but simplex noise only has to check n+1 values in its simplex. For 3D and especially 4D noise that's a huge performance advantage.

edit: Turns out simplex noise is O(n^2), still faster than Perlin noise.


> simplex noise scales O(n)

Typo? Simplex noise scales at O(n^2), not O(n).


Hm, not a typo, I thought it was O(n) since that's how simplices scale with dimensions. Where does the extra *n come from? I guess identifying the right simplex isn't free..

Right, the gradients will still have more dimensions to evaluate.


O(n) measures the number of vector operations, but each one operates over a vector, so there are n^2 arithmetic operations. This is also true for perlin noise - there are 2^n vector operations, but the arithmetic complexity is O(n.2^n).

Obviously this ignores the parallelizability of the algorithms, which is probably the more important factor at this point, and the ability to be hardware accelerated.

(Edit: the complexity is outlined on page 20 of the original simplex noise paper[1]. Just ctrl+f "complexity")

[1] https://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf


Makes me wonder how much revenue Perlin ended up getting from that patent, and if he'd consider it worth it in hindsight.

A lot of projects are created in parts of the world without software patents. So I think nothing will change.

See this excellent video[0] on the quality of Perlin in Godot versus other kind of noise which looks random at first sight, but isn't when you change the time scale. Especially around 10-15 min. Godot has an "OpenSimplex" implementation to avoid patent issues, yet still improve on Perlin noise.

[0]: GDC, "Math for Game Programmers: Juicing Your Cameras With Math" https://www.youtube.com/watch?v=tu-Qe66AvtY


If simplex noise covers a larger range, why not figure out the relationship between input->output range (or standard deviation), and apply that as a normalisation to the inputs? I assume the relationship is predictable, and tuning the inputs wouldn't increase computational complexity. The differing ranges make it hard to compare and hard to see the different artifacts.

Author of the post here. I agree. It's not a big deal. I just wanted to compare the two and document my findings. As I said in the post, Simplex isn't a drop in replacement for Perlin, but it's easy enough to tweak the values to match if that's what you need to do. Most applications of Perlin noise (from what I can see) are more on the creative side of things, and in most cases, someone is just fiddling with some values until something "looks right" anyway.

Indeed, the comparisons seems meaningless to me. Having play a little with Perlin noise I just see samples a different scales/ranges and not anything fundamentally different.

For those wondering:

> Perlin noise is a procedural texture primitive, a type of gradient noise used by visual effects artists to increase the appearance of realism in computer graphics. The function has a pseudo-random appearance, yet all of its visual details are the same size. This property allows it to be readily controllable; multiple scaled copies of Perlin noise can be inserted into mathematical expressions to create a great variety of procedural textures. Synthetic textures using Perlin noise are often used in CGI to make computer-generated visual elements – such as object surfaces, fire, smoke, or clouds – appear more natural, by imitating the controlled random appearance of textures in nature.

An example for Perlin noise in production is the terrain generation in Minecraft: https://minecraft.fandom.com/wiki/Noise_generator


For a "cannot unsee" demo of Simplex Noise in 2d, see the animation on the first row [1]. Simplex Noise is a light/dark pattern in each hexagon.

[1]: https://www.redblobgames.com/x/2107-webgl-noise/webgl-noise/...


The "cannot unsee" remark is a good one. I feel the same way about Perlin noise. Once you learn to recognize it, you see it everywhere. Personally, I find it looks really artificial in an unpleasant way. I don't know why it's so popular in games. Maybe just name recognition?

Personally, I think value noise (with multiple octaves) is underrated:

https://en.wikipedia.org/wiki/Value_noise


It's common because Simplex noise is encumbered by patents.

OpenSimplex noise [0] has become somewhat popular in recent years since it gets similar results without infringing on the patent, but Perlin noise is decades older and have more name recognition, more implementations, etc.

[0] https://github.com/KdotJPG/OpenSimplex2


That's really interesting. In the OP article I was noticing that instead of the horizontal artifacts of Perlin noise, Simplex noise had diagonal artifacts. And this is why

I would be very interested in what those differences regarding higher-dimensional slices look like. The fact that the amplitude or frequency content are different is more or less meaningless given the empiric nature of it all (and in many cases one computes the noise over multiple octaves anyway).

Here you go: https://computergraphics.stackexchange.com/questions/4212/wh...

It isn't just a matter of values clustering around the average; values aren't evenly distributed so just scaling doesn't improve it at all. You have to tune a smoothstep specifically to it, and past 4d you need multiple smoothsteps. Even with that it's gonna look different, and it's just overall not ideal.

For instance if you're writing graphics effects and you have a 3d noise that you want to transition to a 2d noise if it's farther away or not intersected, you'll get a noticeable change in the visual feel that you have to go back and fix.


In creating https://github.com/bit101/bljs/blob/master/src/noise.js, did the author port the C++ code from here [0]?

I'm not familiar enough with Perlin or Simplex noise to know if it's standard to use the same "random" values in the permutation table across implementations [1].

[0] https://cm-gitlab.stanford.edu/andreab/mus320c-harmonizer/bl...

[1] https://github.com/bit101/bljs/blob/master/src/noise.js#L37-...


Really underrates how significantly more nicely simplex tiles than Perlin. With Perlin you have to use MUCH larger maps to get patterns that do not look repetitive.

The continuous gradient function is also extremely important for 3d graphics. The surface may look fine, but the normal of Perlin noise has giant discontinuities between tiles.


It makes no sense to say simplex has more range or contrast. You can just scale it. You need to normalise them before comparing to do a proper comparison.

No. The histogram changes: https://computergraphics.stackexchange.com/questions/4212/wh...

Higher dimensional simplex noise has a lower-contrast distribution, not just lower contrast values. If you just naively scale it you end up with a bunch of points that are <0 or >255.


Has someone come up with a mapping from Perlin to Simplex? It looks to me like Perlin is slightly low resolution and less amplitude scale. Thus it should be possible to write an equation that mostly maps one to the other -- thus simplifying replacing Perlin with Simplex and vice versa while keeping the distribution relatively the same.

With statistics I bet one could derive this mapping equation pretty quickly. Then it would be interesting to compare the resulting residuals or statistical differences at that point. Because it would be comparing the actually differences rather than these more surface differences.


I'm not sure that would be possible. These are both just ways of problem-solving the gradient of diffusion of random bit noise once it's blown up to a larger size. The Simplex method appears a lot more prone to volatility. The peaks and valleys are more extreme given the same parameters. Crushing the peaks and valleys would lead to compression artifacts or else lengthening the frequency to stretch out the band. Maybe I'm wrong, but fundamentally the fastest way would be to reproduce the underlying noise and then re-render it in the other method.

If we have two different random number generators, and yours has various artifacts that make it non-random in some circumstances (and perhaps mine has different artifacts that make it non-random in different circumstances) then there isn't just some simple "mapping" you can do to go from yours to mine.

I was trying to say one could map the std deviation and mean feature size between the two. Currently that isn't done. Thus the 2D scale appears to differ between the two as well as the min/max delta.



Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: