passTexture
A node that extracts a specific data texture, such as a depth or normal texture, from a `pass` render pass, allowing it to be sampled and used like a standard texture in the node graph.
Core Advantages
Its core value is unlocking access to non-color data buffers within a render pass, especially the depth buffer. It seamlessly converts this often hard-to-reach data into a standard TSL texture node, making it an absolute prerequisite for advanced screen-space effects like soft particles and SSAO.
Common Uses
Implementing soft particles: Achieving a smooth fade-out effect at intersections by comparing particle depth with scene depth.
Screen-Space Ambient Occlusion (SSAO): Providing the core scene geometry depth information to the SSAO post-processing shader.
Visualizing the depth buffer: Rendering the depth map as a color for debugging and understanding scene layout.
How to adjust
The core of adjustment lies in how you 'read' and 'interpret' the data this node provides. For instance, distorting the sampling UVs (e.g., `depthMap.uv( screenUV.add(noise) )`) can create water ripple or heat haze effects. Remapping the output depth value (e.g., with `smoothstep`) can create high-contrast contour lines for artistic control.
Code Examples
1// 1. Create a render pass for the main scene
2const scenePass = pass( scene, camera );
3
4// 2. Extract the depth texture from the scenePass
5const depthMap = passTexture( scenePass, scenePass.depthTexture );
6
7// 3. Use the depth map as a color output, sampling with screenUV
8const finalColor = depthMap.uv( screenUV );