Tilt Shift

Create a tilt-shift effect simulating a shallow depth of field.

The TiltShift effect is part of the postprocessing package. It allows you to create a tilt-shift effect, simulating a shallow depth of field.

Usage

The <TiltShiftPmndrs> component is straightforward to use and provides customizable options to fine-tune the tilt-shift effect.

<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { EffectComposerPmndrs, TiltShiftPmndrs } from '@tresjs/post-processing'
import { NoToneMapping } from 'three'

const gl = {
  clearColor: '#0ff000',
  toneMapping: NoToneMapping,
}

const effectProps = {
  focusArea: 0.7,
  feather: 0.1,
}
</script>

<template>
  <TresCanvas v-bind="gl">
    <TresPerspectiveCamera :position="[5, 5, 5]" />

    <!-- Your scene -->

    <Suspense>
      <EffectComposerPmndrs>
        <TiltShiftPmndrs v-bind="effectProps" />
      </EffectComposerPmndrs>
    </Suspense>
  </TresCanvas>
</template>

Props

PropDescriptionDefault
blendFunctionDefines how the effect blends with the original scene. See the BlendFunction options.BlendFunction.NORMAL
offsetThe relative offset of the focus area. A positive value shifts the focus area upwards, while a negative value shifts it downwards. Range: [-0.5, 0.5].0.0
rotationThe rotation of the focus area in radians. A positive rotation turns the focus area clockwise. Range: [-π, π].0.0
focusAreaThe relative size of the focus area. Range: [0, 1].0.4
featherThe softness of the focus area edges. Range: [0, 1].0.3
kernelSizeThe blur kernel size. See the KernelSize options.KernelSize.MEDIUM
resolutionScaleThe resolution scale. Range: [0.1, 1].0.5
resolutionXThe horizontal resolution. Use Resolution.AUTO_SIZE for automatic sizing.Resolution.AUTO_SIZE
resolutionYThe vertical resolution. Use Resolution.AUTO_SIZE for automatic sizing.Resolution.AUTO_SIZE

Further Reading

For more details, see the TiltShiftEffect documentation.