Open PoseidonEnergy opened 3 weeks ago
I've been playing around with the AnalyticLightNode.setupShadow()
function in three.webgpu.js (version 168dev) in the hope that I'll stumble upon a fix, but I've had no luck. The code in the AnalyticLightNode
class looks interesting, and may be where the bug is, but I'm not sure...the fix may lie elsewhere.
Link to version 168: https://unpkg.com/browse/three@0.168.0/build/three.webgpu.js
if ( renderer.coordinateSystem === WebGPUCoordinateSystem ) {
coordZ = coordZ.mul( 2 ).sub( 1 ); // WebGPU: Convertion [ 0, 1 ] to [ - 1, 1 ]
}
Description
Note: I'm using the WebGPU build 167 of three.js for this report.
See screenshot, JSFiddle, and provided code. 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". This top shadow appears whenlogarithmicDepthBuffer
istrue
. How can I remove the shadow from the top floor? I don't want to disablelogarithmicDepthBuffer
, because I need it elsewhere in my scene. I also don't want to disable the top floor's ability to receive shadows from other objects, so I can't setreceiveShadow = false
on the top floor mesh.JSFiddle: https://jsfiddle.net/0fwkyvu6
discourse thread: https://discourse.threejs.org/t/duplicate-shadow-shadow-appears-below-and-above-object-webgpu-build-167/69481
StackOverflow question: https://stackoverflow.com/questions/78893677/three-js-duplicate-shadow-issue-bug-shadow-appears-below-and-above-object
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.
Reproduction steps
Please use the provided code to reproduce the issue.
Code
Version
167
Device
Desktop
Browser
Chrome, Edge
OS
Windows