5.4.0

Soft Shadows

Injects percent closer soft shadows (PCSS) into THREE's shader chunk.

Injects percent closer soft shadows (pcss) into THREE's shader chunk. Mounting/unmounting this component or changing its props will cause all shaders to be recompiled.

Usage

<script setup lang="ts">
import { SoftShadows, Levioso, TorusKnot, Plane } from "@tresjs/cientos";
import { TresCanvas } from "@tresjs/core";
</script>

<template>
  <TresCanvas shadows clear-color="#82DBC5">
    <Levioso :speed="4" :range="[0, 0.7]" :rotation-factor="9">
      <TorusKnot cast-shadow :scale="0.45">
        <TresMeshStandardMaterial color="orange" />
      </TorusKnot>
    </Levioso>
    <Plane :position="[0, -2, 0]" receive-shadow :args="[10, 10]">
      <TresMeshStandardMaterial />
    </Plane>
    <TresDirectionalLight cast-shadow :position="[0, 3, 0]" />
    <TresAmbientLight :intensity="0.5" />
    <SoftShadows />
  </TresCanvas>
</template>

Props

NameDescriptionDefault
sizeSize of the light source (the larger the softer the light)25
samplesNumber of samples (more samples less noise but more expensive)10
focusDepth focus, use it to shift the focal point (where the shadow is the sharpest)0 (the beginning)