A class that creates an anaglyph effect using physically-correct off-axis stereo projection.
This implementation uses CameraUtils.frameCorners() to align stereo camera frustums to a virtual screen plane, providing accurate depth perception with zero parallax at the plane distance.
Note that this class can only be used with WebGLRenderer. When using WebGPURenderer, use AnaglyphPassNode.
AnaglyphEffect is an addon, and must be imported explicitly, see Installation#Addons.
import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js';
Constructs a new anaglyph effect.
renderer
The renderer.
width
The width of the effect in physical pixels.
Default is 512.
height
The height of the effect in physical pixels.
Default is 512.
The interpupillary distance (eye separation) in world units. Typical human IPD is 0.064 meters (64mm).
Default is 0.064.
The distance in world units from the viewer to the virtual screen plane where zero parallax (screen depth) occurs. Objects at this distance appear at the screen surface. Objects closer appear in front of the screen (negative parallax). Objects further appear behind the screen (positive parallax).
The screen dimensions are derived from the camera's FOV and aspect ratio at this distance, ensuring the stereo view matches the camera's field of view.
Default is 0.5.
Frees internal resources. This method should be called when the effect is no longer required.
When using this effect, this method should be called instead of the default WebGLRenderer#render.
scene
The scene to render.
camera
The camera.
Resizes the effect.
width
The width of the effect in logical pixels.
height
The height of the effect in logical pixels.