Nodejs is not supported threejs?

Nodejs is not supported threejs? I want the server to render

That is not possible. Rendering is always frontend and need to be done by the client, because a Graphics Card is needed for rendering. You CAN set up a system to provide WebGL canvas for frontend.

this will run under node: GitHub - pmndrs/three-stdlib: 📚 Stand-alone library of threejs examples designed to run without transpilation in node & browser

you can combine this with headless rendering, puppeteer for instance.

three.js has no official support for node.js however many setups work. For examples three.js uses node.js for generating screenshots from all official examples in context of E2E testing.

Like with any other WebGL content it’s important to run your code in an appropriate environment. The mentioned puppeteer project is a good start.

1 Like

Wait a moment. So you telling me, that you can make screenshots from a 3D scene (canvas/div) from backend ? How do they do that? I thought that this is not possible.

I do not have the time to explain the approach in detail so I suggest you study the sources by yourself. You can find them here:

The script puppeteer.js contains the actual screenshot logic.

1 Like