A classic psychedelic video effect is to use the previously rendered image with the current one. This can create a “tracers” like effect, showing the history of color. For example, the animation of this cube is being additively blended with the previous frame that was rendered. You can control the intensity in which it's blended, scale the coordinate space of which the previous image is sampled, and the hue shift of the pixel sample.
The colour and uv transformations above propagate with each image. When the previous image is scaled a small, fixed amount, the next pass will transform it again, scaling the scaled result. Similar with hue shifting, a small hue shift will propagate and cycle through the colours of the rainbow 🌈 .
Working in Unstable Environments
What if the environment you’re working with is chaotic, perhaps driven by user input where the image can be composed of pixels of any intensity. How does one compose such effects when the image is bright to begin with? An unconstrained additive feedback loop of a video stream can easily lead to “white outs” in images where the commutative summation of pixels blows out to values far above 1.0, which visually doesn’t represent anything meaningful.
The following technique strategically blends the previous frame with the current one to prevent white-outs like above.
Edge Detection Mask
Applying an edge detection pass defines a mask to propagate the feedback loop. This mask will be the additive blending factor and decrease to zero as the loop propagates. You can soften the edges by applying a blur pass as well.
The transformation we've been using up until now has been to scale the previous texture by a fixed amount from the center. You can get really creative with this part by applying translations with various types of noise. In this example, Curl Noise is applied to the sampling of the feedback buffer.
This is an effect included in the .show app. Instead of performing a hue shift, it sets the masked feedback colour to a yellow-ish tint, while making it approach a darker red. The sample space is translated upward, with a Fractional Brownian motion noise function to mimic the unpredictable nature of fire. My poor spider plant 😭
Filter Developer Program
Want to get paid to write some shaders with us? Check out our .show Filter Developer Program!