atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.22k stars 249 forks source link

Request to Load GLB Files with Draco Compression Errors #627

Open ziadsmater opened 1 year ago

ziadsmater commented 1 year ago

We are currently working on a project that involves loading large glb files for buildings. We have been successfully using Draco compression for most glb files without any issues. However, we have encountered a specific problem with certain glb files that have errors in the Draco compression.

Despite the compression errors, we would like to ask if there is a possibility to still load these glb files. We understand that loading them might result in missing or incorrect geometry, but it is important for us to access the data within these files.

Any guidance, suggestions, or alternative approaches that can allow us to load the glb files despite the compression errors would be greatly appreciated. We are open to exploring any available options or workarounds.

Thank you for your attention to this matter. We look forward to your response.

Best regards,

ziadsmater commented 1 year ago

We found the issue in these lines https://github.com/atteneder/glTFast/blob/5c36f4405012b13ad14ec871b77ba063c53cbbc3/Runtime/Scripts/PrimitiveCreateContextBase.cs#L47C12-L47C50

https://github.com/atteneder/glTFast/blob/5c36f4405012b13ad14ec871b77ba063c53cbbc3/Runtime/Scripts/GltfImport.cs#L3144

It looks like after draco compress the glb , sometimes the primIndex is out of bounds. It may fix this problem for us

We are using older version ( 4.9.1 ) and this edit fixed the issue

if(primIndex < context.materials.Length) context.materials[primIndex] = primitive.material;