pass
A powerful node that encapsulates an entire rendering pass—rendering a specific scene with a specific camera—and provides its result as a texture-like color node for use within another material.
Core Advantages
It seamlessly integrates multi-pass rendering into the TSL node system. It abstracts away complex low-level operations (like managing Render Targets), allowing developers to treat an entire render pass as a simple color input, which dramatically simplifies the creation of effects like portals, security cameras, and dynamic reflections.
Common Uses
Creating portals: The portal's material color is supplied by a `pass` node rendering the destination scene from a camera placed there.
Simulating security monitors: Each monitor screen uses a `pass` node linked to a different fixed camera within the main scene to show a 'live feed'.
Generating real-time reflections: Use a `pass` node to render the surrounding environment from the object's perspective, creating a dynamic reflection map for complex surfaces.
How to adjust
Adjustments are made in JavaScript by modifying the `pass` node's properties or the objects it references. Changing the `camera`'s position in the render loop dynamically updates the view (e.g., moving the portal's perspective). Swapping the `.scene` property instantly changes the rendered content (like switching a TV channel). Lowering the `.resolution` property makes the output pixelated but significantly improves performance.
Code Examples
1// 1. Prepare the scene and camera for the other side of the portal
2const portalScene = new THREE.Scene();
3const portalCamera = new THREE.PerspectiveCamera();
4
5// 2. The portal's material color comes directly from the pass node
6const portalMaterial = new MeshBasicNodeMaterial({
7 colorNode: pass(portalScene, portalCamera)
8});