CreateScreenshot for models loaded from multiple database entries. ServerSide?

Hi guys.

There is a firebase database with huge number of entries. I need to create a program that will go over each entry of that database, load the model depending on data, and take screenshot of that model in multiple sizes and store them into storage

Now, I know that createScreenshot works, as I use it already in the app, but on click, for currently loaded model.

I basically need to do that automatically now for each database entry. Because that will be automatic process, I am thinking if rendering the model in the scene is actually needed or not? Would server side headless engine work on this? Or Offscreen canvas? Or…? What is the best way to achieve this.

I also saw this from @trevordev

Does this work, would it be helpful in my situation?


I think this may help:

1 Like

This is similar to the need I have been prototyping. My use case is generating high resolution renders to email a user once they’ve designed a 3D picture frame product.

I’m using chromedp (headless browser) in Go. You can use Puppeteer or other headless solutions. My solution initialises a new headless context, initialises the scene, renders the model, screenshots, garbage collects the scene and re-initializes to prepare for the next.

It’s working pretty well now I’m trying to get it to run faster. I’m experimenting running a few different browser contexts vs running different canvases on the same page. I haven’t determined which is faster yet but you may want to experiment with both especially if you have a large dataset with a LOT of screens to capture.

Note that if you intend on running this on a server you’ll have to solve “the GPU” problem. Most people run it on a Windows GPU-enabled box. I’m going to be prototyping using Xvfb (virtual X environment buffer). I’d really hate to run a Windows box alongside my stack (barf). If I nail it I’ll consider open-sourcing it for the Babylon community.