Capítulo 261 de 859

Chapter 261: Pass

Core Idea

Abstract base class for all post processing passes.

This module is only relevant for post processing with WebGLRenderer.

Key Concepts

  • clear : boolean: If set to true, the pass clears its buffer before rendering
  • enabled : boolean: If set to true, the pass is processed by the composer.
  • isPass : boolean (readonly): This flag can be used for type testing.
  • needsSwap : boolean: If set to true, the pass indicates to swap read and write buffer after rendering.
  • renderToScreen : boolean: If set to true, the result of the pass is rendered to screen. The last pass in the composers pass chain gets automatically rendered to sc…

Code Examples

import { Pass } from 'three/addons/postprocessing/Pass.js';
  • What it demonstrates: Typical usage of Pass.

Reference Tables

Constructor

Signature
new Pass() (abstract)

Properties

PropertyDescription
.clear : booleanIf set to true, the pass clears its buffer before rendering
.enabled : booleanIf set to true, the pass is processed by the composer.
.isPass : boolean (readonly)This flag can be used for type testing.
.needsSwap : booleanIf set to true, the pass indicates to swap read and write buffer after rendering.
.renderToScreen : booleanIf set to true, the result of the pass is rendered to screen. The last pass in the composers pass chain gets automatically rendered to screen, no matter how this property is configured.

Methods

MethodDescription
.dispose() (abstract)Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app.
.render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) (abstract)This method holds the render logic of a pass. It must be implemented in all derived classes.
.setSize( width : number, height : number ) (abstract)Sets the size of the pass.

Key Takeaways

  1. Most relevant properties: clear, enabled, isPass, needsSwap.
  2. Key methods: dispose, render, setSize.

Connects To