Skip to content

PolarNoiseEffect

Source: PolarNoiseEffect.h

PolarNoiseEffect

class PolarNoiseEffect
src/light/effects/PolarNoiseEffect.h:28

Inherits: EffectBase

Effect: a warped, kaleidoscopic noise field in polar coordinates.

PolarNoiseEffect card PolarNoiseEffect controls

Not a texture scrolling past the panel, but a field that turns and breathes inside it. Three power functions compose to get there, and the effect is mostly parameter choices.

Prior art: Stefan Petrick's polar and noise vocabulary, and Inigo Quilez's domain warping.

Public Attributes

uint8_t bpm = 8 : How fast the field drifts.

uint8_t scale = 40 : Noise cells across the grid. Low gives broad shapes, high gives fine detail.

uint8_t segments = 6 : Kaleidoscope wedges, where 1 disables the fold.

uint8_t warp = 90 : Domain-warp strength, where 0 leaves the field plain.

uint8_t octaves = 2 : fbm octaves, and the main cost knob.

uint8_t twist = 30 : How much the radius shears the angle, giving the field its spiral.

PolarLut::Controls polar : The polar address: the table, its precision, and how a volumetric fixture maps to angle and radius.

Public Methods

virtual inline const char * tags() const override : Catalog tags: this effect is the power-function showcase.

virtual inline Dim dimensions() const override : Volumetric: the field turns through depth.

virtual inline void defineControls() override : Publish the drift, the field's shape, the fold and the polar address.

virtual inline void prepare() override : Build the polar address table for the current geometry.

virtual inline void tick() override : Sample the warped field per pixel, folded into wedges around the center.

More info

The three power functions

PolarLut addresses the grid by angle and radius, which rotates the motion around the center. That address never changes between frames, and computing it per pixel measured 39% of a frame on an S3. warp8 displaces the sample coordinate by a second field, so the field marbles rather than drifts. kaleido folds the angle into mirrored wedges, and the symmetry is free before any sampling.

The controls are the cost knobs

warp is two noise samples plus its inner fbm, so at two octaves this is about four a pixel. On a large wall drop octaves to 1, or warp to 0, and it degrades to a plain polar noise.