Capítulo 274 de 859

Chapter 274: SSRPass

Core Idea

A pass for a basic SSR effect.

Key Concepts

  • blur : boolean: Whether to blur reflections or not.
  • bouncing : boolean: Whether bouncing is enabled or not.
  • camera : Camera: The camera.
  • clear : boolean: Overwritten to perform a clear operation by default.
  • distanceAttenuation : boolean: Whether to use distance attenuation or not.
  • fresnel : boolean: Whether to use fresnel or not.
  • groundReflector : ReflectorForSSRPass: The ground reflector.
  • height : number: The height of the effect.
  • infiniteThick : boolean: Whether to use infinite thickness or not.
  • maxDistance : number: Controls how far a fragment can reflect.

Code Examples

const ssrPass = new SSRPass( {
	renderer,
	scene,
	camera,
	width: innerWidth,
	height: innerHeight
} );
composer.addPass( ssrPass );
  • What it demonstrates: Typical usage of SSRPass.

Reference Tables

Constructor

Signature
new SSRPass( options : SSRPass~Options )

Properties

PropertyDescription
.blur : booleanWhether to blur reflections or not.
.bouncing : booleanWhether bouncing is enabled or not.
.camera : CameraThe camera.
.clear : booleanOverwritten to perform a clear operation by default.
.distanceAttenuation : booleanWhether to use distance attenuation or not.
.fresnel : booleanWhether to use fresnel or not.
.groundReflector : ReflectorForSSRPassThe ground reflector.
.height : numberThe height of the effect.
.infiniteThick : booleanWhether to use infinite thickness or not.
.maxDistance : numberControls how far a fragment can reflect.
.opacity : numberThe opacity.
.output : numberThe output configuration.
.renderer : WebGLRendererThe renderer.
.resolutionScale : numberThe resolution scale. Valid values are in the range [0,1]. 1 means best quality but also results in more computational overhead. Setting to 0.5 means the effect is computed in half-resolution.
.scene : SceneThe scene to render.
.selective : booleanWhether the pass is selective or not.
.selects : Array.<Object3D>Which 3D objects should be affected by SSR. If not set, the entire scene is affected.
.thickness : numberControls the cutoff between what counts as a possible reflection hit and what does not.
.width : numberThe width of the effect.

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 SSR pass.
.setSize( width : number, height : number )Sets the size of the pass.

Key Takeaways

  1. SSRPass extends: Pass
  2. Most relevant properties: blur, bouncing, camera, clear.
  3. Key methods: dispose, render, setSize.

Connects To