CascadedShadowGenerator webgl warning

Hey boys & girls,m :hugs:

I’ve encountered a very bizare & unexpected issue! :))

I have a scene where I’m using a CascadedShadowGenerator, and everything works flawlessly on localhost. However, when I build the code and upload it to the server, I get a WebGL warning, and the shadows appear cut off (as if the shadowZ is very small). Interestingly, if I use a ShadowGenerator, everything works well both locally and in the development environment.

I have attached a few images to illustrate the issue.

I’ve tried to reproduce this on the pg, but without success so far. I’m still working on it.

Any insights are welcome! @Evgeni_Popov maybe
Thank you!



1 Like

That’s hard to tell…

We already had some bugs with packagers that would mess the package. Can you try to disable all optimizations that the packager could do?

Also, do you have the same problem if you use other filter methods (no filter, PCF, Poisson, etc)?

Can you try it with WebGPU? If there is also an error, it will probably be more insightful than the WebGL error…

1 Like

Understood, let me try to reproduce this on an online editor that supports ES6. It is quite hard for me to provide details about the packager and optimizations at the package level because the entire 3D stuff is built in a different repository. It’s built as a package and used in another repository, which is also built and uploaded, making it not too easy to track.

Regarding filters, I’m using PCF (you can check the pg, it’s a simplified version of my scene). I’ll try without and let you know. I’ll also give WebGPU a try. I’ll be back with updates :wink:

1 Like

Ok, it looks like I wasn’t able to reproduce even in an es6 env
https://codesandbox.io/p/sandbox/csg-bbjs-t7gy48
I’ll try tomorrow in my project without filters and with webgpu


It looks like webGPU doesn’t like more from my code :slight_smile:
I don’t know why there is a connection between RenderTargetTexture and ShadowGenerator, we’ll find out :sweat_smile:

I think you will need this import: import '@babylonjs/core/Engines/WebGPU/Extensions';.

1 Like

You where right!
So I’m using webGPU, and no filters and I got this on localhost and the scene freeze. I think it is an infinite loop of warnings, because of this the scene freeze



Those warnings are in the second repo, where we are using the package

But in the package’s repo I got this error for multiple times.The shadow is missing, but the scene is working

There’s something really strange here, the first error is a uniformity error, but we’d also get it in a normal PG if there was such a problem in the shader code (and you would also have it locally)… Also, I can see the use of the round function in the error message, but I looked at our shadow code and couldn’t find any occurrence of round (but maybe Tint adds it itself)…

Your second message shows that you’re using the viewer (SceneManager comes from the viewer): perhaps there’s a problem with this package?

Would you have a direct link we could check? I think it would be difficult to find the problem otherwise…

2 Likes

Oki, let me see what I can do