Hello there
I think I’m trying to do something impossible with BabylonJs but I want to be sure before switching to another technology since I love this library
My goal
Reusing a bunch a code built for Babylon to generate screenshots of Scene on the server-side (serve by Bun but that’s irrelevant for my problem).
What I tried so far
I ran into the NullEngine on Babylon.js docs but I cannot ascertain if you could or couldn’t create screenshots. The example in the doc is running perfectly but every time I try to make a screenshot with CreateScreenshotUsingRenderTargetAsync
, I have a null pointer exception deep inside the babylon library. Same goes with the getDepthMap()
of the DepthRenderer
.
The thing is, I don’t care if all textures are black as mentioned in the doc above because I only need a screenshot for the depth (this I can do in the browser with BabylonJs).
I found some topics in this forum about server-side rendering but they are 4 year-old therefore pretty deprecated.
Example of what I need :
Other ways ?
And lastly, I stumbled on the signature of the constructor of the Engine class
https://doc.babylonjs.com/typedoc/classes/BABYLON.Engine#constructor.new_Engine
It seems a canvas html element is not mandatory. What the heck is a WebGL2RenderingContext (no API documentation) ? Or the OffscreenCanvas ?
If someone could clear this up, I’ll drop my experimentations and switch to another solution, like exporting the scene and using another engine.
Puppeteer
Finally, there is the Puppeteer solution but it’s cheating and too memory intensive
But… why ?
Yes I know, my request seems very strange but thoses screenshots will be created on the fly by a python script running in Flask and implementing a ControlNet node for the InvokeAI workflow to create an animation, I have strong requirements unfortunately
Anyway, thank in advance