BabylonsJS: 5.29 (lastest)
Compilation: OK (if I roll back the refreshRate modification)
Problem: _needNormals error if use REFRESHRATE_RENDER_ONEVERYFRAME
I have only one shadow, so I search and test on a simple playground until finding the solution.
“shadowGenerator.getShadowMap().refreshRate” from “REFRESHRATE_RENDER_ONCE” to “REFRESHRATE_RENDER_ONEVERYFRAME”
But when I do this changement in my global project code, I get the following error :
Uncaught TypeError: Cannot create property '_needNormals' on string '#define SM_FLOAT 1
#define SM_ESM 0
#define SM_DEPTHTEXTURE 0
#define SM_NORMALBIAS 0
#define SM_DIRECTIONINLIGHTDATA 1
#define SM_USEDISTANCE 0
#define SM_SOFTTRANSPARENTSHADOW 0
#define NUM_BONE_INFLUENCERS 0'
at t.isReadyForSubMesh (supervisor-babylonjs.js:196517:1683252)
at t.isReady (supervisor-babylonjs.js:196517:843950)
at t.isReady (supervisor-babylonjs.js:196517:504727)
at t._checkIsReady (supervisor-babylonjs.js:196517:507834)
at supervisor-babylonjs.js:196517:508143
If I remove all “addShadowCaster()” and “receiveShadows” calls, the error disappears but no shadows.
If I roll back “shadowGenerator.getShadowMap().refreshRate” to “REFRESHRATE_RENDER_ONCE”, the error disappears but only one shadow.
Sadly, I can not create a playground link, because the project is too big and intra-linked.
So I don’t know how to detail more.
Hope someone will be able to help me and perhaps find a solution for others also.
Hi, refreshRate + REFRESHRATE_RENDER_ONCE = Everything works but only one shadow refreshRate + REFRESHRATE_RENDER_ONEVERYFRAME = Crash with error: caught TypeError cannot create property _needNormals on string #define SM_FLOAT 1
When you say refreshRate + REFRESHRATE_RENDER_ONEVERYFRAME did you test by doing shadowGenerator.getShadowMap().refreshRate = REFRESHRATE_RENDER_ONEVERYFRAME explicitely in your code? My point was to test by removing this line altogether because refreshRate = REFRESHRATE_RENDER_ONEVERYFRAME is the default value. Setting it explicitely could be the problem because we are doing some special things when the user is assigning the refreshRate property. So I want to know if the problem comes from assigning this property or not.
Just to be sure, can you test by commenting (removing) the line shadowGenerator.getShadowMap().refreshRate = ... in your code?
The mesh material in cubeSphereMorph.glb does not have any texture, so it may be why it works. Do you use scene.executeWhenReady as a way to start your scene? If not, can you try to use it?
One test you can also do is adding engine.getCaps().parallelShaderCompile = null; when the engine is created and see if that helps.