Recipe 51: Scrunch
- Download the Recipe 51 patch
- Other tutorials in this series:
Book 1 (Recipes 00-12), Book 2 (Recipes 14-25), Book 3 (Recipes 26-43), Book 4 (Recipes 44-49)
- See all Recipes
- Pixel animations
- Feedback with OpenGL
- Color and spatial effects
Sometimes the most effective projections are simple geometric animations. With that in mind, I put together a relatively simple patch that renders a gridshape as if it was a paintbrush. The image is then passed through a feedback path that includes some color and spatial manipulations. To give the whole thing a nice crunchy, demoscene-inspired pixel look, we can drop the dimensions on the captured texture and blow out the color scaling. I can almost hear the filter sweeps.
This patch uses the nodes object as the main drawing interface for the OpenGL gridshape position and scaling. By moving the node around and scaling it (Option/Alt-drag) we can reposition and resize the shape onscreen. This is an unusual way to use nodes, but it provides a nice interface for this purpose, and the values are easy to parse with a few route objects.
You’ll notice that as you move the shape around, it leaves behind a trail of shapes. This is achieved by accumulating captured frames with texture feedback. You may not see any patchcords making a loop, but the feedback in this case is accomplished by rendering a background videoplane with the previous captured frame mapped to it. By passing the captured texture through a jit.gl.pix object (similar to jit.gl.slab), we can store each frame as it goes. We also pass the captured texture post-jit.gl.pix to a videoplane that is rendered onscreen.
Now if all we were doing was accumulating shapes onscreen this patch would be pretty boring. Using jit.gl.pix, we also have some zoom, offset, and color scaling/biasing happening to each frame as it comes through. The accumulation of these subtle manipulations each frame adds up to some dynamic effects.
To get the pixelated look, try turning off @adapt on the jit.gl.node object and changing the “dim” control. To prevent the texture from getting a fuzzy linear interpolation look on output, we send the message “sendoutput filter nearest” to both the jit.gl.node and jit.gl.pix objects.