Reading compressed gltf without bin

I have installed OpenCASCADE with Draco support and can now read compressed GLB and compressed GLTF files with BIN files. However, I am unable to read compressed GLTF files without BIN (embedded GLTF) files using the following code:

RWGltf_CafReader reader;
reader.Perform(gltfFile, msg);

I am encountering several issues with this. Can anyone please guide me on how to resolve this?

Dmitrii Pasukhin's picture

Hello, only with your file samples. It is not possible to find problem with nothing.

Best regards. Dmitrii.

Swapnil Vikhe's picture

As we know, there are three types of GLTF files:

1. GLTF with BIN
2. GLTF without BIN (embedded GLTF)
3. GLB

I want to read compressed GLTF files without a BIN file, but I am unable to do so. Does the Perform method support reading GLTF files without a BIN file?
because while reading those kind of files, I am facing following issue

File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.
File '/home/pts/Documents/input_files/gltf/draco_gltf/EHSC(compressed_without_bin).gltf' defines invalid glTF!
Buffer '0' refers to invalid indices.\

Dmitrii Pasukhin's picture

Looks like as invalid gltf file or internal reading bug. I can't help without file sample. Yes, Perform working with both format at the same time.

Best regards, Dmitrii.

gkv311 n's picture
  1. Check file with online validators like glTF-Validator for errors and warnings.
  2. Share the file sample, so that experts could check what is going wrong.
  1. GLTF with BIN
  2. GLTF without BIN (embedded GLTF)
  3. GLB

The reality is a little bit more complicated than just these 3 options.

Swapnil Vikhe's picture

Hi,

I have shared one cube(compressed embedded gltf) zip file below,
please check

Attachments: 
Swapnil Vikhe's picture

Any update for me?

Dmitrii Pasukhin's picture

Only a few hour left. But i found that it can be internal bug. Native gltf viewer have no problem with this file. Please create an issue in OCCT bug tracker.

Best regards, Dmitrii.

gkv311 n's picture

OK, so this file represents a quite rare type of glTF: Draco compression + base64 encoding. base64 is expensive ASCII-based encoding of binary data, which occupies more space than original data. The reader has to support the chain base64 -> Draco binary data -> decompressed data, which OCCT doesn't support right now (you may use GLB, GLB+Draco, glTF+base64, glTF+bin, glTF+bin+Draco).

Don't know if it is trivial to fix or not. But practically speaking, I don't see practical reasons for using such combination at all. If glTF reader supports Draco compression, then it should support GLB binary format, hence using base64 option looks redundant.

The header of the file indicates that this glTF file was exported by Blender 3.5. In Blender 4 I cannot even find an option to export glTF file like this, so I guess developers decided to remove such awkward combination.

How you ended up with this problem? You have to support any glTF files given by user and user provided such sample files?

Dmitrii Pasukhin's picture

Thank you for your research. Indeed, looks not usual way to export or store data. In this case I can create a new ticket(in case if reporter will not) for new reading feature. At least to keep that request in bug tracker. But better to have original reporter as a creator.

FSD_Base64 already used for images or "data:application/octet-stream;base64,". I hope will not take a long time, but yes 2 times conversion can impact on logic.

Best regards, Dmitrii.

Swapnil Vikhe's picture

Hey Dmitrii,
It seems like I don't have access to the issue tracker.
Could any user drop an issue there?

Dmitrii Pasukhin's picture

Any registered - yes. https://tracker.dev.opencascade.org/

If you see you as a "Anonimus" in the right corner - you need to log out and then log in with your profile.

Best regards, Dmitri.

Swapnil Vikhe's picture

Yes, thanks, I can log in to the issue tracker,

Whom should I select in the "assign to" section?

Dmitrii Pasukhin's picture

The assign person will be automatically as soon as you choose the caregory OCCT Data Exchange.

Best regards, Dmitrii.

Swapnil Vikhe's picture

Thanks,
I have raised the issued on "issue tracker"
https://tracker.dev.opencascade.org/view.php?id=33734

Swapnil Vikhe's picture

hey Dmitrii,
When are you planning to release OpenCascade 7.9?

Dmitrii Pasukhin's picture

IV quarter 2024.

Best regards, Dmitrii.