dbhvk Posted October 3, 2018 Share Posted October 3, 2018 I'm trying to load the following GLTF (https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.filesInput.ts#L161) in a sandbox-like manner but without using the drop monitor or an standard file input. I do have the file instance for each file, and when I manually set the lowercased-name of the file + the file instance on the FilesToLoad object, the GLTF will fail to load with the following error: n {cameras: Array(0), lights: Array(0), meshes: Array(2), skeletons: Array(0), particleSystems: Array(0), …} "Unable to load from blob:http://localhost:3000/2a140a19-0e8d-47a6-bad0-d4d8b2e0c1c7: #/bufferViews/6: Invalid typed array length: 288" Error: #/bufferViews/6: Invalid typed array length: 288 at preview.js:36 preview.js:36 Uncaught (in promise) Error: #/bufferViews/6: Invalid typed array length: 288 at preview.js:36 [...] bundle.js:162382 BJS - [09:58:31]: Error while trying to load image: [object Blob] I've been trying to load GLTFs and GLBs with texture dependencies (with no luck). The error while loading a blob is common as well. Any ideas on where to start to debug this? The scene is loading with the standard scene loader pointing to an object url with the file extension correctly forced. It works for any gltf/glb with bundled base64 materials. Update (relevant gltf parts): { "bufferView" : 6, "byteOffset" : 0, "componentType" : 5126, "count" : 36, "max" : [ 1.000000, 1.000000 ], "min" : [ -1.000000, -1.000000 ], "type" : "VEC2" } [...] { "buffer" : 0, "byteLength" : 288, "byteOffset" : 1572, "target" : 34962 } Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 3, 2018 Share Posted October 3, 2018 This error is usually raised by an invalid Glb/tf file. You could try to validate your file in the Khronos gltf validation tool or through the babylonjs inspector in the gltf file. Quote Link to comment Share on other sites More sharing options...
dbhvk Posted October 3, 2018 Author Share Posted October 3, 2018 Oh it loads just fine in the sandbox + it's a model from Khronos' own example repo Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 3, 2018 Share Posted October 3, 2018 Oh that is more interesting then, could you try recreating the issue in the playground ? Quote Link to comment Share on other sites More sharing options...
dbhvk Posted October 4, 2018 Author Share Posted October 4, 2018 Hmm, works in the playground, but ported it to codepen so I can initialize stuff myself and get a different error (but still an error), can you check please? https://codepen.io/belohlavek/pen/ZqOWWW The error should be: babylon.js:1 Uncaught (in promise) Error: #/images/1/uri: Failed to load 'AnimatedCube_MetallicRoughness.png': 404 I'm fine with that one (that's what I get on the Playground btw), means that I need to add more files to the FilesToLoad list. Quote Link to comment Share on other sites More sharing options...
bghgary Posted October 4, 2018 Share Posted October 4, 2018 If you want to use "file:" to load files, all the files that are referenced by the glTF must be included in the files. In this case, the glTF is inlined, but the images that it references are not present in the list. Quote Link to comment Share on other sites More sharing options...
dbhvk Posted October 5, 2018 Author Share Posted October 5, 2018 Yep, the thing is that's not the error I get on codepen. If you run the code on the playground, the error will inform that images cannot be found, that's fine. For codepen and my codebase I get two different errors for the same babylon version. So just to clarify: BJS - [21:11:46]: Unable to load from file:simon_scene.gltf: loadAssets of unknown ?that's the codepen error and it's not the expected one Quote Link to comment Share on other sites More sharing options...
bghgary Posted October 5, 2018 Share Posted October 5, 2018 I'm not getting the error you are getting for the codepen link you sent. There are a couple of issues with the codepen page: In order to load glTF files, you need to include loaders/babylon.glTFFileLoader.js (for example from here: https://cdn.babylonjs.com/loaders/babylon.glTFFileLoader.js) see http://doc.babylonjs.com/how_to/gltf#setup Codepen appears to stop execution when any exception is thrown. There is an exception that is being thrown by Babylon because it is trying to check if there is a manifest. You can disable this by calling "engine.enableOfflineSupport = false" after creating the engine. After fixing these two, I get the reference errors for the external files. Quote Link to comment Share on other sites More sharing options...
dbhvk Posted October 5, 2018 Author Share Posted October 5, 2018 You are right, that generates the expected errors on codepen! There's still my inicial issue that I can't replicate elsewhere, so I'll beat my head against the wall a bit during the weekend a report back if I can reproduce it Cheers bghgary 1 Quote Link to comment Share on other sites More sharing options...
dbhvk Posted October 5, 2018 Author Share Posted October 5, 2018 A gltf file would reference a texture like: Texture.png But that name doesn't contain the "file:" prefix, how does babylon look inside the FilesToLoad in the first place? Where is the "file:" added? Looking at: https://github.com/BabylonJS/Babylon.js/blob/1d2dea433c7ea5db14fefa1ea9acceb756a3db10/src/Tools/babylon.tools.ts#L857-L861 Quote Link to comment Share on other sites More sharing options...
bghgary Posted October 5, 2018 Share Posted October 5, 2018 Ah, yes. That's a good observation. You need to put "file:" as the first parameter rootUrl instead of putting it as part of the second parameter sceneFilename. The rootUrl will be prepended to the uris of the glTF file. dbhvk 1 Quote Link to comment Share on other sites More sharing options...
dbhvk Posted October 5, 2018 Author Share Posted October 5, 2018 That was it, rock and roll! For some reason the error reports where super obscure on my project, but at the end of the day the issues were the same. bghgary 1 Quote Link to comment Share on other sites More sharing options...
Ballon Posted July 31, 2019 Share Posted July 31, 2019 On 10/4/2018 at 3:19 PM, bghgary said: If you want to use "file:" to load files, all the files that are referenced by the glTF must be included in the files. In this case, the glTF is inlined, but the images that it references are not present in the list. So can you disregard or ignore a material asset file for a 3d file defined in the gltf or obj spec any way to ignore errors and continue to load asset without materials Quote Link to comment Share on other sites More sharing options...
Guest Posted September 26, 2019 Share Posted September 26, 2019 Please post your question on the new forum:https://forum.babylonjs.com/ 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.