I want to use BabylonJS for a project in which I want to display data fetched from an API within a 3D environment. This data will simply be strings, along with some image URLs which I want to display using the 3D GUI system that comes with BJS.
Since I don’t have much back-end experience – for a theoretical standard 2D DOM implementation of this project – I would use Node.JS along with Express and EJS (templating language) to serve a serverside rendered HTML page, since this is the method I’m most familiar with.
I’d love to know if it’s possible to do something similar with BabylonJS. Using any of the previously mentioned systems would be preferred since it’s the only back-end libraries I have experience with, but any other implementation is also very welcome.
For clarity’s sake, this is essentially what I want my website to do:
- Fetch data from an API upon loading the webpage
- Display this data using the 3D GUI system in BJS
- Filter this data using buttons within the 3D GUI system
I’ve been looking online to try and find how to do this myself, but couldn’t find much of anything to help me.
Any help would be appreciated, even if it’s just a nudge in the right direction
EDIT: Through ChatGPT I’ve found that it’s possible to serve an HTML file which has inline javascript, and using an HTML templating language within that inline JS. However, I’d like to be able to have my JS in a seperate file, so that I can use ES6 and tree shaking.
Is there any way to accomplish this?
The main thing I don’t understand is how to get the data from my Node.JS index.js file to my javascript file to actually display the data. The data is passed to the HTML page when a get request is received by the Node server, but I don’t understand how to then pass this data on further to a javascript file which contains my BabylonJS code.