imageworks/OpenShadingLanguage — pull request #105 by lgritz (2012-01-17 07:30:02+00:00)
Title: Review: Gabor noise

This adds a new noise type, "gabor", which is as described in the Lagae et al. papers of SIGGRAPH 2009 and 2011. It's a sparse convolution noise using an impulse kernel that has nicer bandwidth properties and can be properly filtered (anisotropically, no less). It's quite a bit more expensive than Perlin noise (at least 20x, though in subsequent work I may try to trim that down even farther), but its antialiasing is vastly superior.

In keeping symmetry with the other noise types we support, we have 1-, 2-, 3-, and 4-D domains, both non-repeating as well as periodic (with the period determined by the shader). Currently, the 4D is broken -- merely returning the 3D and ignoring "t" -- I just couldn't bear to figure out what a 4D Gabor kernel should look like and how to properly filter it. Also, the 1- and 2-D varieties just use a slice of the 3D; if people tend to use 2D rather than 3D enough, I may code a less expensive true 2D version. Chalk those up to future work, if anybody ever cares.

There's a bunch of infrastructure fixes along the way, including making a straightforward Imath-inspired 2x2 matrix class and some beefing up of Dual2 functionality.

This method of having a single noise() call that takes a noise type name as a parameter (e.g., noise("perlin",P), noise("gabor",P)) makes it easy to add additional noises later on, or renderer-specific noises, without breaking OSL syntax or adding entire new API calls to the OSL standard library. It's simply a runtime error to ask for a noise type that is not known.