2020-11-27 15:47

Simplex noise

This patch implements noise("simplex",...) for OSL. Like the "perlin" noise, it's aperiodic, ranges on [-1,1] with a large-scale average of 0. There's also "usimplex" which is the unsigned version -- range [0,1] with an average of 0.5, analogous to our "uperlin". I have NOT implemented a periodic (pnoise) version of simplex noise; since it's not a rectangular grid, imposing a rectangular periodicity is a bit trickier to implement, so I'll hold off on that unless/until there's a significant demand.

Simplex is similar in character to Perlin noise but has some important differences: 1. At 2D and higher, the frequency content is a bit higher than Perlin noise (that is, the waves are steeper and closer together. This is because the simplex vertices are on average closer together than the rectilinear grid vertices of Perlin. 2. At 2D, the simplex noise bumps fully blend into each other (as Perlin does at all octaves), but at 3D a single octave looks a bit more like separated bumps, and it's very noticeable at 3D. This is all pretty noticeable with a single octave, but much harder to see when multiple octaves of noise are used. 3. Also because of the layout of the simplex grid, there is a some directionality visible in 2D planar slices of the 4D noise. You may find this objectionable, or maybe for a curved solid object, you won't notice it at all. Use your best judgment.

Simplex noise is currently about 5% slower than Perlin for 1- and 2-D, about 10% faster than Perlin for 3D, and over 2x faster than Perlin for 4D noise. So at 3D and especially for 4D (especially the latter), you may prefer it for performance, if the look is acceptable.

The underlying implementation of the simplex noise is based on public domain code by Stefan Gustavson, though heavily modified.


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享