googlevr / tilt-brush-toolkit

Scripts and assets that help you use Tilt Brush data in your creative projects.
Apache License 2.0
745 stars 164 forks source link

.glb import error #49

Open kndol opened 4 years ago

kndol commented 4 years ago

When I try to import .glb file made by Tilt Brush, I meet an error:

Asset import failed, "Assets/glb/kbk.glb" > GlbError: bin length%4 TiltBrushToolkit.GlbParser.Err (System.String fmt, System.Object[] args) (at Assets/TiltBrush/Scripts/Gltf/GlbParser.cs:32) TiltBrushToolkit.GlbParser.GetBinChunk (System.String glbPath) (at Assets/TiltBrush/Scripts/Gltf/GlbParser.cs:126) TiltBrushToolkit.BufferedStreamLoader.Load (System.String uri) (at Assets/TiltBrush/Scripts/Gltf/IUriLoader.cs:126) TiltBrushToolkit.Gltf2Root.Dereference (System.Boolean isGlb, TiltBrushToolkit.IUriLoader uriLoader) (at Assets/TiltBrush/Scripts/Gltf/Gltf2Schema.cs:103) TiltBrushToolkit.ImportGltf.BeginImport (System.String gltfOrGlbPath, TiltBrushToolkit.IUriLoader uriLoader, TiltBrushToolkit.GltfImportOptions options) (at Assets/TiltBrush/Scripts/Gltf/ImportGltf.cs:253) TiltBrushToolkit.ImportGltf.Import (System.String gltfOrGlbPath, TiltBrushToolkit.IUriLoader uriLoader, TiltBrushToolkit.IImportMaterialCollector materialCollector, TiltBrushToolkit.GltfImportOptions options) (at Assets/TiltBrush/Scripts/Gltf/ImportGltf.cs:166) TiltBrushToolkit.Glb2Importer.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at Assets/TiltBrush/Scripts/Editor/Glb2Importer.cs:45) UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at /Users/builduser/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22)

.glb file size is 1,523,711,658 bytes, and it cannot be divided by 4. I guess this problem is of the Tilt Brush app.

dubois commented 4 years ago

Have you seen it with other .tilt files besides this one? How big is the .tilt?

kndol commented 4 years ago

The size of .tlt file is 121,975,962 bytes. Currently, only this file has the problem.

ShamanUX commented 3 years ago

I'm having the same problem. Did you find a solution?

dubois commented 3 years ago

It is very likely a problem in Tilt Brush, not the Tilt Brush Toolkit. Tilt Brush development has suspended, but I suggest logging a bug in https://github.com/icosa-gallery/open-brush

n1ckfg commented 3 years ago

I'd try just opening it in Open Brush first and see what happens--that's built in Unity 2019 instead of 2018, and I'd expect GLTF handling to improve for each major version

dubois commented 3 years ago

Good point to try it out first before reporting the bug!

Tilt Brush / Open Brush gltf export is homegrown. Well, mostly homegrown; it's originally based on some truly ancient Tony Parisi code. If the bug's now fixed, it'll be thanks to some kind Open Brush volunteer!

Lesterpaintstheworld commented 2 years ago

Same problem here on OpenBrush

andybak commented 2 years ago

Quick potential workaround.

Comment out line 126 in Assets/TiltBrush/Scripts/Gltf/GlbParser.cs and reimport the asset.

// if ((binLength % 4) != 0) { Err("bin length%4"); }
dubois commented 2 years ago

This should be moved to a bug in OpenBrush. The bug is that TB/OB creates non-spec-compliant .glb files. Andy's workaround may not be a 100% fix, since there may be other issues with the glb data lurking around

Gildas310 commented 1 year ago

Quick potential workaround.

Comment out line 126 in Assets/TiltBrush/Scripts/Gltf/GlbParser.cs and reimport the asset.

// if ((binLength % 4) != 0) { Err("bin length%4"); }

Hi Andybak, I am happy to see you again

your solution works for me in Unity URP 2020.3.33f1 with the tilt-brush-unitySDK-URP-AltSpace-alpha_v06.unitypackage

I just comment out, then restart the unity project

So thank you again !

My glb file weighs 99.2 Mo and it comes from Tilt Brush