Capítulo 236 de 859

Chapter 236: TexturePass

Core Idea

This pass can be used to render a texture over the entire screen.

Key Concepts

  • map : Texture: The texture to render.
  • material : ShaderMaterial: The pass material.
  • needsSwap : boolean: Overwritten to disable the swap.
  • opacity : number: The opacity.
  • uniforms : Object: The pass uniforms.

Code Examples

const texture = new THREE.TextureLoader().load( 'textures/2294472375_24a3b8ef46_o.jpg' );
texture.colorSpace = THREE.SRGBColorSpace;
const texturePass = new TexturePass( texture );
composer.addPass( texturePass );
  • What it demonstrates: Typical usage of TexturePass.

Reference Tables

Constructor

Signature
new TexturePass( map : Texture, opacity : number )

Properties

PropertyDescription
.map : TextureThe texture to render.
.material : ShaderMaterialThe pass material.
.needsSwap : booleanOverwritten to disable the swap.
.opacity : numberThe opacity.
.uniforms : ObjectThe pass uniforms.

Methods

MethodDescription
.dispose()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 )Performs the texture pass.

Key Takeaways

  1. TexturePass extends: Pass
  2. Most relevant properties: map, material, needsSwap, opacity.
  3. Key methods: dispose, render.

Connects To