I hope you can help me somehow. After hours of searching and reading through forums, I couldn’t find a solution to my problem. The issue occurs exclusively on Mac with the Safari browser:
When I render a screenshot using CreateScreenshotUsingRenderTarget and then try to load a GLB into the scene, the GLB does not load. The console shows the following error log:
BJS - [14:19:58]: Unable to load from https://www.babylonjs.com/Assets/DamagedHelmet/glTF/DamagedHelmet.gltf: undefined is not an object (evaluating 'h._features.forceBitmapOverHTMLImageElement')
How can I solve this problem? I definitely want to render the scene using CreateScreenshotUsingRenderTarget.
Here is the playground for testing: When a screenshot is taken, the helmet is not loaded into the scene.
Thank you for testing, RaananW! No, I don’t have a special Safari version: Version 18.3 (18620.2.4.111.8, 18620
I guess it must be a local issue on my MacBook.
Thank you very much for the tip, Simone. Unfortunately, it didn’t make any difference, the error persists. Maybe it’s due to my old OS (Ventura 13.7.3 (22H417)).
It’s complicated. I’m working on a Photoshop UXP plugin where I want to use Babylon. On my test Mac, the mentioned error also occurs in Photoshop. I had read that Photoshop actually uses the Chromium browser. I’m at a loss.
I think I found the reason why this issue is happening.
The problem is in the dumpTools.ts#L40-L47.
First, it tries to create a new Engine using OffscreenCanvas and in case WebGL is not supported it falls back to normal Canvas.
But the problem is that the previously created Engine (w/ OffscreenCanvas) remains in the EngineStore but in an uninitialized state (_initFeatures was not called, etc.).
This results in 2 engines stored inside EngineStore: #1 - a fully functional Engine used by the main scene, and #2 - an uninitialized leftover created by DumpTools.
Later, when we try to load a new GLB model (or any other action using fileTools), we end up on fileTools.ts#L210 which grabs “broken” engine #2 from the EngineStore and fails on line fileTools.ts#L241 (_features was not initialized in the constructor).
I can see two possible solutions here:
a) remove the engine instance from the EngineStore before throwing an error (thinEngine.ts#L391-L404)
b) handle this situation in dumpTools.ts and remove the “broken” instance from EngineStore in line dumpTools.ts#L44 before creating another Engine instance.
Here is the PG that demonstrates the problem in any browser:
Thanks for your effort! The fact that the problem seems to be identified definitely makes it easier to test (on the PC). However, I unfortunately don’t have any idea on how to implement any of your solutions.
It also works perfectly on the Mac with Safari. Now I’m looking forward to the 7.48.0 release. Thanks again @dgorbash, and @RaananW (hab grad gesehen, du kommst aus der Hauptstadt, ganz liebe Grüße aus Johannisthal Nachbar:)). You’re awesome!