rtt
A powerful node that abstracts the complex 'Render to Texture' workflow, allowing you to render the output of any node network into a usable texture in real-time.
Core Advantages
It fully automates the complex low-level operations of managing render targets (FBOs) and can read its own output from the previous frame. This enables easy implementation of on-GPU feedback loops and stateful simulations (like fluids or trails), dramatically lowering the barrier to creating advanced dynamic effects.
Common Uses
Implementing post-processing effects like bloom and depth of field.
Creating feedback loop effects, such as ink bleeds, image trails, and reaction-diffusion patterns.
Generating complex procedural textures in real-time to avoid expensive calculations in the main render.
Simulating mirrors or portals by rendering a virtual camera's view to a reflection texture.
How to adjust
Adjustments focus on resolution and the input node's logic. Lowering the resolution (`width`, `height`) improves performance at the cost of quality. In a feedback loop, changing the mix factor in the input node controls the length of trails or the speed of the effect's evolution. Changing the texture `type` in `options` (e.g., to `HalfFloatType`) enables support for HDR data, which is crucial for effects like bloom.
Code Examples
1// 1. Define a pattern to be rendered into the texture
2const patternToRender = checker( uv().mul( 10 ) );
3
4// 2. Use rtt to render the pattern into a 512x512 texture
5const proceduralTexture = rtt( patternToRender, 512, 512 );