I found a weird bug that only happens in certain conditions.
this is an error message
BJS - [13:25:19]: Offending line [646] in fragment code: refractionIntensity*=refractionIntensityMap.r; logger.js:56:30
BJS - [13:25:19]: Error: FRAGMENT SHADER ERROR: 0:646: 'refractionIntensity' : undeclared identifier
ERROR: 0:646: 'assign' : l-value required (can't modify a const)
If you export a mesh with a material with a Transmisson texture in the blender to GLTF
the problem will be reproduced.
Here’s a glb file that reproduces that error.
gltf_load_test.zip (634.8 KB)
This error can only be reproduced by loading using the asset container.
The code is as follows:
const assetContainer = await SceneLoader.LoadAssetContainerAsync("res/gltf_load_test.glb");
assetContainer.addAllToScene();
If you run addAllToScene in setTimeout, there will be no problems.
const assetContainer = await SceneLoader.LoadAssetContainerAsync("res/gltf_load_test.glb");
setTimeout(() => {
assetContainer.addAllToScene();
}, 1000);
There is no error even if you use the SceneLoader.Append
SceneLoader.Append("res/gltf_load_test.glb",);
I don’t know exactly what the problem is, but I presume it’s a problem related to refraction.
When I analyzed the code to find the cause, I found one oddity: in the pbrSubSurfaceConfiguration, _isRefractionEnabled is initialized to false and I couldn’t find any code to override it to true anywhere. I think it’s probably related to this bug.
Thank you in advance for your help.