viewportTexture
viewportTexture
Provides direct access to the currently rendered screen image (viewport), forming the basis for post-processing effects. It fully automates complex backend render target management.
Core Advantages
Greatly simplifies implementing post-processing effects like color correction, screen-space distortion, and blur. Developers can easily read and process the scene's final rendered result without manually managing Framebuffer Objects (FBOs).
Common Uses
Post-processing color correction
Screen-space distortion and refraction
Video feedback and ghosting effects
How to adjust
Achieve various screen-space distortion effects, such as water waves, heat haze, or a magnifying glass effect, by providing a perturbed UV coordinate node as its `uvNode` parameter.
Code Examples
1// Get the color of the current screen pixel
2const screenColor = viewportTexture();
3
4// Invert the color's RGB components
5const invertedColor = screenColor.rgb.oneMinus();