How can I render three.js server side? At the moment our website renders player avatars using three.js locally, however that issues security things as well as potential bugs with people with less-end computers (people can inject the code into console and have it render god knows what..)
I looked into using node.js but all documentation on that is vague and appears to be quite outdated..
Any help would be useful
Current local: http://pastebin.com/yv5Qamfz
Server-side rendering (SSR) is an application's ability to convert HTML files on the server into a fully rendered HTML page for the client. The web browser submits a request for information from the server, which instantly responds by sending a fully rendered page to the client.
three. js is a client side library. Even if you dynamically generate markup server-side, the code will still be executed client-side.
Server-Side JavaScript is the use of the JavaScript language on servers. You know, those computers that are always on (and maybe online) running stuff, doing all kinds of work. Nowadays many of them have software, web servers, command-line applications, and other services that are written in JavaScript.
Next.js has two forms of pre-rendering: Static Generation and Server-side Rendering. The difference is in when it generates the HTML for a page. Static Generation (Recommended): The HTML is generated at build time and will be reused on each request. Server-side Rendering: The HTML is generated on each request.
There are several discussions about using three.js on node.js on the three.js GitHub page. Check for example:
There is also this question on stackoverflow which could be considered a duplicate of your question.
This one is dealing with a project called node-three.js on GitHub. It will support rendering in three.js on node.js. Not sure if it does exactly what you want (I have no first hand experience with this library) but worth checking it out I guess.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With