An outline effect for toon shaders.
Note that this class can only be used with WebGLRenderer. When using WebGPURenderer, use ToonOutlinePassNode.
const effect = new OutlineEffect( renderer );
function render() {
effect.render( scene, camera );
}
OutlineEffect is an addon, and must be imported explicitly, see Installation#Addons.
import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js';
Constructs a new outline effect.
renderer
The renderer.
parameters
The configuration parameter.
When using this effect, this method should be called instead of the default WebGLRenderer#render.
scene
The scene to render.
camera
The camera.
This method can be used to render outlines in VR.
const effect = new OutlineEffect( renderer );
let renderingOutline = false;
scene.onAfterRender = function () {
if ( renderingOutline ) return;
renderingOutline = true;
effect.renderOutline( scene, camera );
renderingOutline = false;
};
function render() {
renderer.render( scene, camera );
}
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.
This type represents configuration settings of OutlineEffect.
defaultThickness
number
The outline thickness.
Default is 0.003.
defaultColor
Array.
The outline color.
Default is [0,0,0].
defaultAlpha
number
The outline alpha value.
Default is 1.
defaultKeepAlive
boolean
Whether to keep alive cached internal materials or not.
Default is false.