Easiest way to render in Node using Three.js

What is the easiest way to render in Node.js?

I tried SoftwareRenderer and got it working, but I keep running into inconsistencies with WebGLrenderer.

I just tried headless-gl and got it working for a very simple example.

It’s important to me that I get the same result in the backend and the frontend. With SoftwareRender that worked fine I have not tested with headless-gl.

Are there any other options? What do you recommend?

1 Like

I’ve used Puppeteer to render with WebGL and save it out to images in the past – it’s basically just headless chrome.

5 Likes

Do you use some CI with it?

You can use it for CI but I haven’t done any testing with image diffs or anything myself. There’s some discussion around that in this issue, though:

1 Like

Here I have a repo with three.js testing in CI with puppeteer.

Can you share some sample code. I am trying to load glb model and generate thumbnail for the same model.

If you take a look at the puppeteer docs there’s information on how to load a page and take a screenshot.