SoftShadows rendererTarget

hello every one
i try use SoftShadow for 1 model file and 1 mesh
and i want plane mesh shadow is SoftShadow and model shadow is normalshadow
but now all mesh and model shadow is SoftShadows
is it possible Apply shadows type separately?

import {SoftShadows} from "@react-three/drei";
 {!loading && floorMesh && (
        <>
          <SoftShadows size={56} focus={2} samples={20} />
        </>
      )}
      <mesh name="plane" ref={planeRef}>
        <meshBasicMaterial />
      </mesh>

      <OrbitControls
        ref={orbitControl}
        makeDefault
        userData={{ name: "OrbitControls" }}
        minAzimuthAngle={-100}
        maxAzimuthAngle={100}
        maxZoom={1000}
      />
      <Environment files={studio_small} />

softshadows hacks into three shaderchunks to establish percentage closer soft shadows, it’s not something you can select - with that component all shadows will distribute semi-realistically.

if you need help with configuring it properly look at this box

otherwise, i think what you really want is this:

it’s called accumulative shadows and bakes shadows on a transparent plane. after the baking it has practically zero expense.

as a rule of thumb:

  • softshadows for interactive and moving scenes. preferrably darker scenes to hide the noise. you want as few samples as possible because ss can be expensive
  • accumulativeshadows for static scenes and where you’re OK with shadows falling on a bottom plane only
1 Like

thanks for advice me
i understande i tried accumulativeshadows but crash with TransformControls
i think have to use softshadows cause i want dynamic scenes cause control obejct
thank you so much

it … crashes? do you have a small repro/sandbox i could look at?

1 Like

thanks for reply
https://codesandbox.io/p/sandbox/baking-soft-shadows-forked-jl98ly?file=%2Fsrc%2FApp.js
AccumulativeShadows and i add TransformControls
now have some error but will be fine after remove TransformControls
and i found someone have a same issue

thank you so much

could you try PivotControls? transform does some things i do not understand, like attaching and detaching objects. i tried to debug but the error happens deeply inside transformcontrols and i’m not too familiar with it.

edit:
i think i know what it is. accumulativeshadows has to override scene materials with a discard material in order to calculate plane shadows efficiently. this would be no problem but unfortunately transformcontrols has a custom updateMatrixWorld which accesses its own materials. acc-shadow calls render, render calls transform.uMW and it breaks. and no idea how to fix this … :-S

1 Like

thank you for advice me
i will try PivotControls if i find something new i will reply
have a nice day thank you so much