0

Note: I'm using the WebGPU build 167 of three.js for this question and JSFiddle.

See screenshot and JSFiddle. I have a simple sphere between two "floors", with a DirectionalLight pointing straight down from above. Notice how the sphere casts a shadow on the top "floor". How can I remove the shadow from the top floor? I don't want to disable the top floor's ability to receive shadows from other objects though, so I don't want to set receiveShadow = false on the top floor mesh.

JSFiddle: https://jsfiddle.net/0fwkyvu6

three.js GitHub bug report: https://github.com/mrdoob/three.js/issues/29200

I also posted the question on the three.js community discourse: https://discourse.threejs.org/t/duplicate-shadow-shadow-appears-below-and-above-object-webgpu-build-167/69481

Update 1: setting logarithmicDepthBuffer: false appears to fix the issue somewhat, however the logarithmic depth buffer is a requirement for my scene, so I'd like to get the shadow working with it.

Update 2: the top shadow is not visible in the standard WebGLRenderer build of three.js, so there must be some issue specifically with the WebGPU build.

enter image description here

6
  • See jsfiddle.net/vb179y4r I spent some time cleaning up your code and it appears to work. Perhaps you can see if you can figure out what is different... Commented Aug 20, 2024 at 20:07
  • @WestLangley Thanks for taking a look at this. I checked out your edits, and I saw you removed logarithmicDepthBuffer--I need to have logarithmicDepthBuffer enabled for other things in the scene, if you add logarithmicDepthBuffer: true to your JSFiddle then the top shadow appears again. Commented Aug 20, 2024 at 20:29
  • OK, so you have your answer... A reasonable guess is WebGPURenderer does not yet support logarithmicDepthBuffer for Orthographic (shadow) cameras. Commented Aug 20, 2024 at 21:01
  • Here I changed your fiddle to use a SpotLight: jsfiddle.net/847uqt2j Commented Aug 20, 2024 at 21:07
  • @WestLangley once again thanks for looking into this. It still creates the duplicate shadow however if you move the spotlight's position up a little: jsfiddle.net/heb3tg50/1 Commented Aug 20, 2024 at 21:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.