Bugs related to certain versions of shadows


I’m having the same problem with the link

A simple setup for my problem is:

(code line){

let canvas = document.getElementById(“renderCanvas”);
let engine = new BABYLON.Engine(canvas, true, { disableWebGL2Support: false });

let directionalLight = new BABYLON.DirectionalLight(“DirectionalLight”, new BABYLON.Vector3(4.636,
0.162, -5.103), scene);
directionalLight.direction = new BABYLON.Vector3(0, -10, -5)
directionalLight.intensity = 3;
directionalLight.diffuse = new BABYLON.Color3(1, 1, 1);
directionalLight.specular = new BABYLON.Color3(1, 1, 1);
directionalLight.shadowMinZ = -10;
directionalLight.shadowMaxZ = 6;

//frustum size control

directionalLight.orthoLeft = -20;
directionalLight.orthoRight = 20;
directionalLight.orthoTop = 10;
directionalLight.orthoBottom = -10;
directionalLight.position.x = 4.68;
directionalLight.position.z = -5.1;
let shadowGenerator = new BABYLON.ShadowGenerator(4096, directionalLight);
shadowGenerator.useBlurExponentialShadowMap = true;
shadowGenerator.useKernelBlur = true;
shadowGenerator.blurKernel = 8;
shadowGenerator.depthScale = 1;
shadowGenerator.debug = true;
shadowGenerator.depthClamp = 1000;

shadow works fine with WebGL1
but WebGL2 doesn’t working

i check this error


my packge.json (build by wepack)

It was confirmed that it was not related to other factors.
In addition, we confirmed the operation of webGL2 in the latest version beta 2,5.
(And so is PG)
However, it cannot be used in the latest version due to an unresolved problem of recast.

Same as for these links


Back to the main topic, we are looking for a way to solve the shadow error in a specific version (5.0.0 alpha 37),WebGL2.

Changed all versions to 4.2.1.
and everything has been resolved
but I think the original problem has not been solved
so i look forward to the official release of 5.0.0


1 Like

I am not getting shadows with BJS 5 latest at all in my project, trying to solve the issue. Maybe it’s my fault tho :speak_no_evil: I am not sure yet, but no errors in the console and I did quite a lot of shadowing stuff before. Maybe some defaults were changed…

What’s the game you’re working on? Looks cool from the screenshots. :vulcan_salute:

1 Like

You can’t mix versions of Babylon.js, you must use the same version for all the packages you are using: in your first screenshot you are using some modules in 5.0 and others in 4.2.


Your game looks beautiful :slight_smile: can t wait to try it


This is part of the company’s outsourcing, and I think the game quality is not so good. Scheduled to open in April

Probably because there was nothing called and used in version 4.2, I think it would not have been affected even if the versions were mixed.
Also, by checking these issues in the forum, other projects are not mixing them.

i will pass on your praise to the designer. Thank you.