@threlte/extras

<FakeGlowMaterial>

This component is a port of ektogamat’s <FakeGlowMaterial> r3f component which displays a glowing outline around a mesh using a custom shader, instead of post-processing.

Examples

Basic Example

FakeGlowMaterial.svelte
<script lang="ts">
  import { T } from '@threlte/core'
  import { FakeGlowMaterial } from '@threlte/extras'
</script>

<T.Mesh>
  <FakeGlowMaterial glowColor="red" />
  <T.IcosahedronGeometry args={[4, 4]} />
</T.Mesh>

This effect is mesh based, meaning you need to provide a mesh for this to work properly. The mesh must also be smooth enough that glsl can calculate the normals properly.

For sharp meshes like a cube, you can use a sphere to simulate the glow, instead of a copy of the cube.

FakeGlowMaterialCube.svelte
<script lang="ts">
  import { T } from '@threlte/core'
  import { FakeGlowMaterial } from '@threlte/extras'
</script>

<T.Mesh>
  <FakeGlowMaterial glowColor="blue" />
  <T.BoxGeometry args={[2, 2, 2]} />
</T.Mesh>

<T.Mesh>
  <FakeGlowMaterial glowColor="blue" />
  <T.IcosahedronGeometry args={[3, 4]} />
</T.Mesh>

Component Signature

<FakeGlowMaterial> extends <T.ShaderMaterial> and supports all its props, slot props, bindings and events.

Props

name
type
required
default
description

falloff
number
no
0.1
Controls the value of the Falloff effect. Ranges from 0.0 to 1.0.

glowColor
ColorRepresentation
no
"green"

glowInternalRadius
number
no
6.0
Controls the internal glow radius. Ranges from -1.0 to 1.0. Set a darker color to get the fresnel effect only.

glowSharpness
number
no
1.0