yatao-wf Posted November 12, 2018 Share Posted November 12, 2018 I'm pretty new for babylon framework and I'm trying to load glb model without a public url for security reason. So I tried to load it directly from content string, but it didn't work for some reason and I have no idea why unfortunately. I've shared my playground here: https://playground.babylonjs.com/#7F6S08 I tried both `raw_content` and `base64_model_content` and none if it worked. Would appreciate anyone can help here. 2ftx4ft.glb Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 30, 2018 Share Posted November 30, 2018 Hi @yatao-wf, welcome to the forum! No help with this, yet, eh? Sorry Y. Have you had any new success? Let's bump this issue to the top of the list and see if we can get some fresh eyes/comments. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 30, 2018 Share Posted November 30, 2018 Adding @bghgary Wingnut 1 Quote Link to comment Share on other sites More sharing options...
bghgary Posted November 30, 2018 Share Posted November 30, 2018 This is a case that the code doesn't handle. I've filed an issue: https://github.com/BabylonJS/Babylon.js/issues/5579 In the meantime, you can do this a bit indirectly by using a blob with an object url. https://playground.babylonjs.com/#7F6S08#2 Note that your base64 encoded string was incorrect compared to the file you attached. I had to re-encoded the data. Wingnut and Sebavan 2 Quote Link to comment Share on other sites More sharing options...
Vorpal Posted February 12, 2020 Share Posted February 12, 2020 HI, bghgary, nice solution THen how convert glb model datas in base64 datas ? Thanks Quote Link to comment Share on other sites More sharing options...
Vorpal Posted February 13, 2020 Share Posted February 13, 2020 bghgary , Could it be possible to load texture with your solution ? Quote Link to comment Share on other sites More sharing options...
foxbit19 Posted May 4, 2020 Share Posted May 4, 2020 @bghgary thank you very much for this solution! @Vorpal To convert the model, read it as a generic attachment and convert it to base64. You can use Buffer class method to convert it from and to base64 format: // converts from Blob (of File) class to base 64 Buffer.from(content).toString('base64') // converts from base64 string to Buffer (you can use it as argument of Blob constructor) Buffer.from(base64, 'base64') 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.