Skip to content

ContactShadows

<ContactShadows /> is a "fake", non-lighting-based shadow component. It displays shadows on a single plane. The component is based on the THREE.js contact shadows example by @mrdoob.

Usage

vue
<script setup lang="ts">
import { ContactShadows, Levioso, TorusKnot } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
</script>

<template>
  <TresCanvas clear-color="white">
    <Levioso :speed="2" :range="[0, 0.7]" :rotation-factor="9">
      <TorusKnot :scale="0.45">
        <TresMeshNormalMaterial />
      </TorusKnot>
    </Levioso>
    <ContactShadows :position-y="-1" color="#335" :scale="20" />
  </TresCanvas>
</template>

Props

PropDescriptionDefault
opacityThe opacity of the shadows.1
blurThe blur of the shadows.1
colorThe color of the shadows.'#000000'
tintIf provided, the color of the "core" of the shadows. "Added" to color.undefined
scaleThe scale of the shadows/shadow plane. Can be a number or an array of two numbers [x, y].10
widthThe width of the shadow plane.1
heightThe height of the shadow plane.1
farThe distance of the orthographic shadow camera extends above the shadow plane.10
smoothWhether the shadows should be smoothed to reduce artifacts.true
resolutionThe resolution of the shadow textures.512
framesFor performance, optionally stop updating shadows after frames frames.Math.POSITIVE_INFINITY
depthWriteWhether the shadows should write to the depth buffer or not.false