Skip to content

EchoEffect

Source: EchoEffect.h

EchoEffect

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

Inherits: EffectBase

Effect: the previous frame fed back through a zoom and rotation, leaving spiraling trails.

EchoEffect card EchoEffect controls

Each frame reads the previous one back zoomed, rotated and dimmed, with a bright source on top. The trail then spirals away from itself, as a camera pointed at its own monitor does.

Prior art: video feedback, a demoscene and video-art staple.

Public Attributes

uint8_t bpm = 30 : How fast the source orbits.

uint8_t zoom = 12 : How much the feedback grows each pass, where 0 leaves it still.

uint8_t rotate = 8 : Rotation per frame, which turns the trail into a spiral.

uint8_t decay = 24 : How fast the echo fades, so higher gives a shorter trail.

uint8_t size = 2 : The bright source's 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 : Writes the z=0 slice, which extrude fills through a volume.

virtual inline void defineControls() override : Publish the source's orbit, the feedback transform and the trail's decay.

virtual inline void prepare() override : Size one frame of history, which the feedback reads as a stable copy.

virtual inline void tick() override : Run any due feedback pass, draw the source, then keep this frame as the next one's history.

More info

Feedback is not a primitive

Once the grid reads as a texture at sub-pixel coordinates, feedback is three lines. Sample the last frame through a transform, combine it, and draw a source. Motion trails, zoom blur, spiral smear and kaleidoscopic feedback all follow from sampleWrap. So the toolbox gains a general capability rather than one more special case.

This is the clearest use of the gather half of [draw.h], where sampleWrap reads with wrapping. Cost is one bilinear sample a pixel plus a scratch copy, with no divide and no noise.