Best practice for background rendering?

Next to our main scene, we sometimes need to render another object in an offscreen context without showing it to the user.
The offscreen demo Babylon.js - Worker mode is not even running on Chrome under MacOS. What alternatives do I have?
Thanks so much!

You can render into an hidden canvas which will have the same results except for perfs :frowning: I truly wonder why it does not work on MacOS in Chrome.

@Cedric could you have a look ?

Sure! I’ll take a look.

2 Likes

Ok, thanks! I’ll try that. Performance is not an issue in this case.

Indeed, there is no offscreen canvas rendering on Chrome/MacOS.
I’ve tried with Safari and Firefox and a message is displayed saying that offscreen canvas is not supported. Is it possible that it’s not available for Chrome as well but the error message is not displayed?

This sheet says, it should work on Chrome:

This error comes up in Chrome on Mac:

I’ll fix that

Thanks for the report

Thanks @Deltakosh :slight_smile:

Please allow me another question about the hidden canvas concept: How can I make sure, everything is set up correctly (scene, mesh, shader, material) before accessing the created image? Right now, I wait one frame and on MacOS, the image is ready and perfect.
On Windows, sometimes I get the image without the object’s material, sometimes a black image and sometimes everything is fine. When I wait four frames on Windows, most of the times, it seems to be alright - but that cannot be the best solution, right?

I’m not sure this is the problem, but are you using scene.executeWhenReady or something similar?

FWIW , this broke in three recently too. OffscreenCanvas support broken · Issue #22811 · mrdoob/three.js · GitHub

1 Like

No, but I’l try that, thanks!

@jeremy-coleman you nailed it :wink:

I ll have a fix soon

PR is up it will be in the next nightly Fix babylon worker and texture WhenAllReady by sebavan · Pull Request #11457 · BabylonJS/Babylon.js · GitHub

1 Like

Hey there @8thdwarf (great username btw! :rofl: ) just checking in, did @sebavan 's fix solve your issues? :smiley:

Hi Carol,

We gave up. Too unclear what’s happening in the background, too complicated to use.

Best regards,
Moritz Gaupp

**Moritz Gaupp** Managing Director

movingworld GmbH

Hauptstraße 87
76831 Göcklingen
Germany

Telefon: +49 6349-9958992

Mobile: +49 172-6075517
Email: gaupp@movingworld.de
Web: www.movingworld.de

Managing Directors: Claudia Gaupp, Moritz Gaupp Registered: Local Court Landau in der Pfalz, HRB 31401

VAT-Number: DE291776251

Oh, that’s a shame :frowning: Would you mind sharing a bit more of your experience, what you found the hardest to use and what features could have helped you work better? We’d love to know how we can improve.