TardigradeX Posted July 20, 2017 Share Posted July 20, 2017 Hi, I'm working on a medical application where anatomical 3d Models are shown in the Browser. At the moment I am working with Threejs, but I am looking for alternatives and Babylon.js looks very good, especially from a documentation perspective. But I cant find much information about loading Scenes/STLs using XHR Requests. In most tutorials they are loaded as assets directly from the webserver the app is hosted on. So my Questions are: Is it possible to load a scene from an application server which is not the webserver using http GET, including an x-auth-token in the header ? Is it possible to load the file as a binary stream, or in a small format? (Because the models often have a high poly-count) Thanks in advance :-) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 20, 2017 Share Posted July 20, 2017 Hey and welcome to the forum, you can load your scenes from any url. Internally SceneLoader.Load uses an XHR: https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.tools.ts#L459 But you can also load the data on your own and provide the loaded buffer to the STL plugin (which has a load method https://github.com/BabylonJS/Babylon.js/blob/master/loaders/src/STL/babylon.stlFileLoader.ts#L76) For performance, I would highly recommend using glb (gltf binary) as a vehicule for your data. Belnder has a gltf exporter: https://github.com/KhronosGroup/glTF-Blender-Exporter Hope this helps:) Quote Link to comment Share on other sites More sharing options...
TardigradeX Posted July 21, 2017 Author Share Posted July 21, 2017 Thanks for the fast response. The glb format seems like a great option for data transfer. I will look into it. As far as I can see it is not possible to add header data (Security Token) to the request when using the Scene Loader. I will look into loading the raw-data using my own loader and then parsing it using Babylon and share my findings. Maybe an additional header option can be added to the SceneLoader at some point. Greets Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 21, 2017 Share Posted July 21, 2017 That's a good idea. feel free to submit a PR with the change. I'll merge it with pleasure It could be just a static property that we want to add to all xhr for instance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.