5.4.0

Mesh Reflection Material

Makes floors or walls that reflect the objects in your Scene.

The cientos package provides a <MeshReflectionMaterial /> component for making floors or walls that reflect the objects in your Scene.

The component is based on the excellent component of the same name.

It extends THREE.MeshStandardMaterial and accepts all the same props.

Usage

<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { MeshReflectionMaterial } from '@tresjs/cientos'
</script>

<template>
  <TresCanvas>
    <TresPerspectiveCamera :position="[3, 3, 3]" :look-at="[0, 0, 0]" />
    <TresMesh :rotation="[-Math.PI / 2, 0, 0]">
      <TresPlaneGeometry :args="[10, 10]" />
      <MeshReflectionMaterial
        :blur="[300, 100]"
        :mixBlur="30"
        :mixStrength="80"
        :mixContrast="1"
        color="#a0a0a0"
        metalness="0.5"
        roughness="1"
        mirror="0"
      />
    </TresMesh>
    <TresMesh :position="[0, 1, 0]">
      <TresBoxGeometry />
      <TresMeshStandardMaterial color="orange" />
    </TresMesh>
    <TresAmbientLight />
    <TresDirectionalLight :position="[0, 2, 4]" />
  </TresCanvas>
</template>

Props

NameDescriptionDefault
resolutionLength in pixels of one side of the square reflective textures256
mixOverall strength of the reflection1
sharpMixStrength of the sharp reflection on smooth surfaces1
sharpDepthScaleSharp reflection can be faded out by depth – distance from the reflective surface. Performance note: if the value is greater than 0, a depth texture will be created1
sharpDepthBiasSharp reflection depth falloff bias0
sharpDepthEdgeMinSharp reflection depth falloff start0
sharpDepthEdgeMaxSharp reflection depth falloff end0.2
blurMixSmoothStrength of the blurred reflection on smooth surfaces1
blurMixRoughStrength of the blurred reflection on rough surfaces1
blurDepthScaleBlurred reflection can spread out by depth – distance from the reflective surface. Performance note: if the value is greater than 0, depth texture will be rendered1
blurDepthBiasBlurred reflection depth spread bias0
blurDepthEdgeMinBlurred reflection depth spread start0
blurDepthEdgeMaxBlurred reflection depth spread end0.2
blurSizeSize of the blur. If [number, number], first number is width, second is height. Performance note: if other than [0, 0] or 0, a blur texture will be rendered[0, 0]
distortionMapTexture for offsetting the reflectionundefined
distortionInfluence of distortionMap0
reflectorOffsetOffsets the reflection0

Additionally, the component extends THREE.MeshStandardMaterial and accepts all the same props including color, roughness, metalness, map, normalMap, roughnessMap, metalnessMap, and more.