WebGPU with createDefaultEnvironment and groundMirrorFallOffDistance causes crash

Bumped into a issue when using the createDefaultEnvironment helper that I’m not able to resolve. Looks like there is a problem when using WebGPU and the groundMirrorFallOffDistance property of the helper. I get nothing rendered and this in the log:

BJS - [11:38:17]: WebGPU uncaptured error (1): [object GPUValidationError] - Error while parsing WGSL: :461:56 error: unresolved value 'vPositionW'
var reflectionDistanceFalloff: f32=1.0-saturate(length(vPositionW.xyz-uniforms.vBackgroundCenter)*uniforms.vReflectionControl.w);
                                                       ^^^^^^^^^^


 - While calling [Device "BabylonWebGPUDevice1"].CreateShaderModule([ShaderModuleDescriptor ""fragment""]).
(index):1 Error while parsing WGSL: :461:56 error: unresolved value 'vPositionW'
var reflectionDistanceFalloff: f32=1.0-saturate(length(vPositionW.xyz-uniforms.vBackgroundCenter)*uniforms.vReflectionControl.w);
                                                       ^^^^^^^^^^


 - While calling [Device "BabylonWebGPUDevice1"].CreateShaderModule([ShaderModuleDescriptor ""fragment""]).

Reproduction sandbox: Babylon.js Playground

The sandbox works when using WebGL, it’s just on WebGPU it crashes.

Thanks for reporting, this will be fixed once this PR is merged:

2 Likes