Skip to content

outlineEffect

Outline effect using the BackSide + scale approach.

Usage

ts
import { createOutlineMaterial } from '@threeuse/effects'
import { BoxGeometry, Group, Mesh, MeshStandardMaterial } from 'three'

const mesh = new Mesh(new BoxGeometry(), new MeshStandardMaterial())
const outlineMesh = new Mesh(mesh.geometry, createOutlineMaterial({
  color: 0xFFFFFF,
  thickness: 0.03,
}))
outlineMesh.scale.setScalar(1.03)

const group = new Group()
group.add(mesh, outlineMesh)
app.scene.add(group)

Parameters

ParamTypeDefaultDescription
colorstring | number0x000000Outline color
thicknessnumber0.02Outline thickness (scale factor)

Demo

Released under the MIT License.