Jump to content

Customize GLTF loader blob location


jps0611
 Share

Recommended Posts

Howdy,

Is there any way to customize how the blobs from textures in the GLTFLoader are treated? I'm running into an issue where the blobs are violating our content security policy because they are appended to our base url instead of the approved CDN the assets/textures are coming from.

Let's say I'm pulling a GLTF asset via:

let myAsset = assetsManager.addMeshTask("", "", "https://mycdn.com/static/gltf/", "my-asset.gltf");

So instead of:

blob:https://myurl.me/24bde0c8-d576-4abb-a3f4-06a05b38b8f3

We get:

https://mycdn.com/static/gltf/24bde0c8-d576-4abb-a3f4-06a05b38b8f3
Link to comment
Share on other sites

@jps0611 I have a work item in the backlog to add a callback when the glTF loader loads a URI. It will allow you to do whatever you want with the URI.

Short-term, you can override BABYLON.Tools.PreprocessUrl with a function that overrides the url. Note that this affects all URLs that go through BABYLON.Tools.LoadImage or BABYLON.Tools.LoadFile.

Link to comment
Share on other sites

Just to follow up here...we got around this issue by adding blob:oururl.com/* to our CSP.

Gotta say...I'm really a big fan of babylon.js. We've got our first WebGL experience launching next week, and I don't think it would have turned out as well as it did with out the polish and documentation put into this framework. 

JPS

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...