Skip to content

@bluera/vue-threejs-postprocessing

Declarative postprocessing for vue-threejs, built on the postprocessing library.

Ported from @react-three/postprocessing — the React Three Fiber integration for the postprocessing library by vanruesc. The Vue version provides the same declarative component API adapted for Vue's composition patterns.

Availability

@bluera/vue-threejs-postprocessing is included in the monorepo. Install the core package to use it:

Plugin registration

Register as a fiber plugin to set global defaults:

ts
import { createPostprocessingPlugin } from '@bluera/vue-threejs-postprocessing'

<Canvas :plugins="[createPostprocessingPlugin({ multisampling: 4 })]">
ts
// Or app-wide
import { registerFiberPlugin } from '@bluera/vue-threejs'
import { postprocessingFiberPlugin } from '@bluera/vue-threejs-postprocessing'

registerFiberPlugin(app, postprocessingFiberPlugin)

Plugin options

OptionTypeDescription
multisamplingnumberMSAA sample count (default: renderer)
resolutionScalenumberResolution multiplier (default: 1)
enabledbooleanEnable/disable all effects (default: true)

Usage

Wrap your scene with EffectComposer and add effect components as children:

vue
<script setup>
import { Canvas } from '@bluera/vue-threejs'
import { EffectComposer, Bloom, Noise, Vignette } from '@bluera/vue-threejs-postprocessing'
</script>

<template>
  <Canvas>
    <ambientLight />
    <mesh>
      <boxGeometry />
      <meshStandardMaterial color="hotpink" />
    </mesh>

    <EffectComposer>
      <Bloom :intensity="1.5" :luminance-threshold="0.9" />
      <Noise :opacity="0.02" />
      <Vignette :offset="0.3" :darkness="0.7" />
    </EffectComposer>
  </Canvas>
</template>

EffectComposer

Manages the render pipeline. Renders the scene, then applies all child effects in order.

PropTypeDescription
enabledbooleanEnable/disable the composer
multisamplingnumberMSAA sample count
resolutionScalenumberResolution multiplier

Effects

Bloom

HDR bloom with configurable luminance threshold and smoothing.

vue
<Bloom :intensity="1.5" :luminance-threshold="0.9" :luminance-smoothing="0.025" />
PropTypeDefault
intensitynumber1
luminanceThresholdnumber0.9
luminanceSmoothingnumber0.025

BrightnessContrast

Adjust brightness and contrast.

vue
<BrightnessContrast :brightness="0.1" :contrast="0.2" />

HueSaturation

Shift hue and adjust saturation.

vue
<HueSaturation :hue="0.1" :saturation="0.5" />

ToneMapping

Apply tone mapping as a post-effect.

vue
<ToneMapping :adaptive="true" :resolution="256" />

DepthOfField

Bokeh depth-of-field effect.

vue
<DepthOfField :focus-distance="0.01" :focal-length="0.02" :bokeh-scale="2" />
PropTypeDefault
focusDistancenumber0.01
focalLengthnumber0.02
bokehScalenumber2

LUT

Color grading with a lookup table.

vue
<script setup>
import { useLoader } from '@bluera/vue-threejs'
import { LUTCubeLoader } from 'three/examples/jsm/loaders/LUTCubeLoader.js'

const lut = useLoader(LUTCubeLoader, '/my-lut.cube')
</script>

<LUT v-if="lut" :lut="lut.texture3D" />

Noise

Film grain noise overlay.

vue
<Noise :opacity="0.02" />

Vignette

Darkened screen edges.

vue
<Vignette :offset="0.3" :darkness="0.7" />

See also