I have done some tests with shadows in the WebGPU renderer. I know that the WebGPU renderer is still WIP, but wanted to just validate these findings here. I created a codePen for these tests:
https://codepen.io/jarseal/pen/yyyGKPx?editors=1010
Here are some of my findings:
1. Point light shadows break down when using VSMShadowMap
Error (first error message): Error while parsing WGSL: :281:15 error: no matching call to 'textureSampleCompare(texture_2d<f32>, sampler, vec2<f32>, f32)'
Settings to reproduce in the pen:
const isWebGPU = true;
const forceWebGL = false;
const rendererShadowMapType = 'VSMShadowMap';
And it also breaks down with âforceWebGL = trueâ but gives a different error (first error message): THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
Settings to reproduce in the pen:
const isWebGPU = true;
const forceWebGL = true;
const rendererShadowMapType = 'VSMShadowMap';
This works fine in the WebGL renderer.
2. Turning on/off âcastShadowâ and map size dynamically for lights (point, spot, and directional) does not work in WebGPU (also for âforceWebGL = trueâ)
Settings to reproduce in the pen:
const isWebGPU = true;
const forceWebGL = false;
and
const isWebGPU = true;
const forceWebGL = true;
This works fine in the WebGL renderer.
3. Documentation does not match actual behavior
This is not really a bug, but found out that the âLightShadowâ does take into account the âradiusâ value even if the renderer shadow map type is âPCFSoftShadowMapâ for PointLights in WebGPU. In the documentation there is a mention that the âradiusâ does not have any affect if âPCFSoftShadowMapâ is used.
Documentation for LightShadow radius: three.js docs
If WebGLRenderer.shadowMap.type is set to PCFSoftShadowMap, radius has no effect and it is recommended to increase softness by decreasing mapSize instead.
Settings to reproduce in the pen:
const isWebGPU = true;
const forceWebGL = false;
const rendererShadowMapType = 'PCFSoftShadowMap';
and
const isWebGPU = true;
const forceWebGL = true;
const rendererShadowMapType = 'PCFSoftShadowMap';
So, just wanted to validate my findings here. If these are actual bugs/issues and not just some misconfigurations on my part I can make issues out of these in GitHub. I really love the WebGPU renderer. Cheers!