Skip to content

outlineEffect

基于背面外扩(BackSide + scale)方案的描边效果。

用法

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)

参数

参数类型默认值说明
colorstring | number0x000000描边颜色
thicknessnumber0.02描边厚度(scale 值)

Demo

Released under the MIT License.