5.4.0

Stage

Creates a complete stage setup with lighting, shadows, and environment.

This component creates a "stage" for your models. It sets up:

  • model lighting
  • ground shadows
  • zoom to fit
  • environment
If you are using other camera controls, be sure to make them the 'default'.
<OrbitControls make-default />
If you are using shadows='accumulative', enable shadows on your canvas and on your objects.
<TresCanvas shadows />
<TresMesh cast-shadow />
  ...
</TresMesh>

Usage

<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { Stage, OrbitControls, Plane } from '@tresjs/cientos'
</script>

<template>
  <TresCanvas shadows>
    <TresPerspectiveCamera :position="[0, 3, 5]" />
    <OrbitControls make-default />
    <Stage
      lighting="rembrandt"
      shadows="contact"
      :adjust-camera="true"
      environment="city"
      :intensity="0.5"
    >
      <TresMesh cast-shadow>
        <TresBoxGeometry />
        <TresMeshStandardMaterial color="orange" />
      </TresMesh>
      <Plane :position="[0, -2, 0]" receive-shadow :args="[5, 5]">
        <TresMeshStandardMaterial />
      </Plane>
    </Stage>
  </TresCanvas>
</template>

Props

PropDescriptionDefault
lightingLighting setup. Options: null | undefined | false | 'rembrandt' | 'portrait' | 'upfront' | 'soft' | { main: [x, y, z], fill: [x, y, z] }'rembrandt'
shadowsControls the ground shadows. Options: boolean | 'contact' | 'accumulative' | StageShadows'contact'
adjustCameraOptionally wraps and thereby centers the models using <Bounds>, can also be a camera offsettrue
environmentThe default environment'city'
intensityLighting intensity, 0 removes lights0.5
alignTo adjust alignmentundefined

StageShadows Type

When using custom shadow configuration, you can pass an object with the following properties:

PropDescriptionDefault
typeShadow type: 'contact' | 'accumulative'-
offsetShadow plane offset0
biasShadow bias-0.0001
normalBiasShadow normal bias0
sizeShadow map size1024

Additionally inherits all props from AccumulativeShadowsProps, RandomizedLightsProps, and ContactShadowsProps.