Hi guys,
Got a strange shadow “moirée effect” with a mesh , but only when the mesh recieve and cast shadows.
Here the version of the mesh casting and recieving ( if you zoom a lil bit you will see the “moirée”):
Here the version with the stairs just recieving :
Here my directional light and shadow-map:
<directionalLight
ref={directionLight2ref}
castShadow
shadow-mapSize={256 * 2}
position={[-10, 10, 0]}
intensity={1}
shadowIntensity={1}
>
<orthographicCamera
attach="shadow-camera"
args={[-6, 6, 6, -6, 1, 20]}
/>
</directionalLight>
It’s strange I use the same directional light and shadow map on another scene , with another meshes and geometries and everything is smooth and clear
try:
shadowBias={0.001}
or
shadowBias={-0.001}
on the directionalLight
shadowBias={0.001} :
shadowBias={0.001}:
Also tried switching different values for the shadow radius… doesn’t work.
Tried to remove the another directional light and its shadows… nothing change
Here by increasing the shadow map size to 1024:
The moirée is just more tight
Try a bigger bias… like .05
This is a suuuper common issue with shadowmapping.
Which values/ranges cause it varies depending on the scale of your geometry, the coverage area of the light… and the shadowmap resolution… (and the resolution of the depth buffer which can vary by gpu)
end of the day… you find the .bias value that fixes it and move on to the next problem.
1 Like
Just found the solution, tried all values from 0.000 to 0.5 … nothing worked, the glb got DoubleSide, just replaced it by FrontSide and everything works!!
Thanks @manthrax <3
2 Likes