Capítulo 589 de 859

Chapter 589: Reflector

Core Idea

Can be used to create a flat, reflective surface like a mirror.

Note that this class can only be used with WebGLRenderer. When using WebGPURenderer, use ReflectorNode.

Key Concepts

  • forceUpdate : boolean: Whether to force an update, no matter if the reflector is in view or not.
  • isReflector : boolean (readonly): This flag can be used for type testing.

Code Examples

const geometry = new THREE.PlaneGeometry( 100, 100 );
const reflector = new Reflector( geometry, {
	clipBias: 0.003,
	textureWidth: window.innerWidth * window.devicePixelRatio,
	textureHeight: window.innerHeight * window.devicePixelRatio,
	color: 0xc1cbcb
} );
scene.add( reflector );
  • What it demonstrates: Typical usage of Reflector.

Reference Tables

Constructor

Signature
new Reflector( geometry : BufferGeometry, options : Reflector~Options )

Properties

PropertyDescription
.forceUpdate : booleanWhether to force an update, no matter if the reflector is in view or not.
.isReflector : boolean (readonly)This flag can be used for type testing.

Methods

MethodDescription
.dispose()Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
.getReflectionCamera( camera : Camera ) : CameraReturns a reflection camera for the given camera. The reflection camera is used to render the scene from the reflector's view so correct reflections can be produced.
.getRenderTarget() : WebGLRenderTargetReturns the reflector's internal render target.

Key Takeaways

  1. Reflector extends: EventDispatcher → Object3D → Mesh
  2. Most relevant properties: forceUpdate, isReflector.
  3. Key methods: dispose, getReflectionCamera, getRenderTarget.

Connects To