We have a scene with a static environment/reflection texture, with various meshes using PBR materials, dynamic shadows with the use of shadow depth wrappers. We have objects/nodes being hidden and shown at different times. At some point in that flow we hit the following JS error in our browser console ONLY when we have a browser with a iOS user agent,
TypeError: null is not an object (evaluating 's.USESPHERICALFROMREFLECTIONMAP')
Because the JS is bundled and minified, it’s say it’s at file/line bundle.js.11:3259239, and I can’t really make any sense of it.
This issue doesn’t present itself when we run in a desktop browser that isn’t simulating an iOS user agent. Also doesn’t present itself if we turn shadows off completely.
This issue does present itself on iOS device with Safari and Chrome browsers too.
Can you please suggest how I might be able to debug or fix this issue further?
I was having trouble getting the callstack earlier. But I’ve managed to get it now.
Uncaught TypeError: Cannot read properties of null (reading 'USESPHERICALFROMREFLECTIONMAP')
at t.bind (bundle.js:26:3107156)
at t.bindForSubMesh (bundle.js:26:2565975)
at e._renderSubMeshForShadowMap (bundle.js:26:2729966)
at e._renderForShadowMap (bundle.js:26:2727866)
at e.render (bundle.js:26:4047441)
at e.render (bundle.js:26:853357)
at t.renderToTarget (bundle.js:26:1445595)
at t._render (bundle.js:26:1441364)
at t.render (bundle.js:26:1439219)
at t._renderForCamera (bundle.js:26:273773)
It’s quite impossible understanding a minified stacktrace, especially when bundled by you. Would it be possible to add sourcemaps, or use the unminified source?
Having said that - will you be able to provide a (non) working demo? something devs with iphone can make sense of?
Is that a problem? I found the function to make a ShadowDepthWrapper odd in that you supply the material to the function and you also have to apply the function result to the material that was passed into the function as a parameter. It makes me question if I’m using it correctly.
Additionally the NodeMaterial shader I’m using also has a frame used for providing semi/fading transparent shadows via a BayerDither function which ultimately feeds into a “Discard” block.
Once I can distill the problem down further I would like to provide a PG demo of the issue. I will attempt to get a build setup with sourcemaps or unminified source to get a better handle on the issue and I’ll report back.
A side question while you prepare the repro - did you make due you import all required blocks when building? Could it be that you are missing the block that is responsible for that part?