Outline
An outline effect.
import { Outline } from '@react-three/postprocessing'
import { BlendFunction, Resolution, KernelSize } from 'postprocessing'
return (
<Outline
selection={[meshRef1, meshRef2]} // selection of objects that will be outlined
selectionLayer={10} // selection layer
blendFunction={BlendFunction.SCREEN} // set this to BlendFunction.ALPHA for dark outlines
patternTexture={null} // a pattern texture
patternScale={1.0} // the pattern texture scale
edgeStrength={1.0} // the edge strength
pulseSpeed={0.0} // a pulse speed. A value of zero disables the pulse effect
visibleEdgeColor={0xffffff} // the color of visible edges
hiddenEdgeColor={0x22090a} // the color of hidden edges
multisampling={0} // the number of samples used for multisample antialiasing, requires WebGL 2
resolutionScale={0.5} // render resolution scale
resolutionX={Resolution.AUTO_SIZE} // render width
resolutionY={Resolution.AUTO_SIZE} // render height
kernelSize={KernelSize.VERY_SMALL} // blur kernel size
blur={false} // whether the outline should be blurred
xRay={true} // indicates whether X-Ray outlines are enabled
/>
)
Example
Props
| Name | Type | Default | Description |
|---|---|---|---|
| selection | Objects | Selection of objects that will be outlined | |
| selectionLayer | Number | 10 | The selection layer |
| blendFunction | BlendFunction | BlendFunction.SCREEN | The blend function of this effect. |
| patternTexture | Texture | null | A pattern texture. |
| patternScale | Number | 1.0 | The pattern texture scale. |
| edgeStrength | Number | 1.0 | The edge strength. |
| pulseSpeed | Number | 0 | The pulse speed. A value of zero disables the pulse effect. |
| visibleEdgeColor | Number | 0xffffff | The color of visible edges. |
| hiddenEdgeColor | Number | 0x22090a | The color of hidden edges. |
| multisampling | Number | 0 | The number of samples used for multisample antialiasing. Requires WebGL 2. |
| resolutionScale | Number | 0.5 | The render resolution scale. |
| resolutionX | Number | Resolution.AUTO_SIZE | The render width. |
| resolutionY | Number | Resolution.AUTO_SIZE | The render height. |
| kernelSize | KernelSize | KernelSize.VERY_SMALL | The blur kernel size. |
| blur | Boolean | false | Whether the outline should be blurred. |
| xRay | Boolean | true | Whether occluded parts of selected objects should be visible. |