toonOutlinePass
toonOutlinePass is an integrated post-processing node designed to generate high-quality, customizable outlines for an entire scene in a cartoon or technical drawing style with a single step. It encapsulates the complex edge-detection logic based on scene depth and normals, greatly simplifying the implementation of outline effects in non-photorealistic rendering (NPR).
Core Advantages
It simplifies the complex implementation of outline effects into a single function call, producing stable, clear, and artistically expressive lines. As a standard post-processing node, it can be easily combined with other effects, offering immense flexibility for creating various visual styles, from anime to engineering blueprints.
Common Uses
Providing the iconic 'ink lines' for anime or cel-shading styles
Enhancing the structural clarity of models in technical or architectural visualizations via outlining
Acting as an artistic filter to create special visual effects like pop art, neon, or hand-drawn sketches by adjusting its parameters
How to adjust
Effects are controlled primarily by adjusting the `color`, `thickness`, and `alpha` parameters in its constructor, or by modifying the corresponding `.colorNode`, `.thicknessNode`, and `.alphaNode` properties after creation. Increasing `thickness` makes lines bolder, changing `color` can match specific artistic styles (like blueprints), and adjusting `alpha` can create various line qualities from hard-edged to soft (like a pencil sketch).
Code Examples
1// Create an outline pass node using the toonOutlinePass function
2const outlineNode = toonOutlinePass(
3 scene,
4 camera,
5 new THREE.Color( 0x000000 ), // Outline color
6 0.005, // Outline thickness
7 1.0 // Outline alpha
8);
9
10// Connect the result of the outline node to the post-processing output
11postProcessing.output = outlineNode;