Capítulo 258 de 859

Chapter 258: MaskPass

Core Idea

This pass can be used to define a mask during post processing. Meaning only areas of subsequent post processing are affected which lie in the masking area of this pass. Internally, the masking is implemented with the stencil buffer.

Key Concepts

  • camera : Camera: The camera.
  • clear : boolean: Overwritten to perform a clear operation by default.
  • inverse : boolean: Whether to inverse the mask or not.
  • needsSwap : boolean: Overwritten to disable the swap.
  • scene : Scene: The scene that defines the mask.

Code Examples

const maskPass = new MaskPass( scene, camera );
composer.addPass( maskPass );
  • What it demonstrates: Typical usage of MaskPass.

Reference Tables

Constructor

Signature
new MaskPass( scene : Scene, camera : Camera )

Properties

PropertyDescription
.camera : CameraThe camera.
.clear : booleanOverwritten to perform a clear operation by default.
.inverse : booleanWhether to inverse the mask or not.
.needsSwap : booleanOverwritten to disable the swap.
.scene : SceneThe scene that defines the mask.

Methods

MethodDescription
.render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean )Performs a mask pass with the configured scene and camera.

Key Takeaways

  1. MaskPass extends: Pass
  2. Most relevant properties: camera, clear, inverse, needsSwap.
  3. Key methods: render.

Connects To