Export normalized UV data into the draco compressed GLTF file

I am trying to create gltf file from step file.
I have read the step file using the step_caf_reader.
I have created the Gltf file using the RWGltf_writer.
I have used the draco compresion for the gltf.
But the UV data in the gltf is not normalized.
How to get put the normalized UV data into the gltf file.
Also I want to use interleaved buffers in gltf file how can we do that

gkv311 n's picture

But the UV data in the gltf is not normalized.

RWGltf_CafWriter efforts UV coordinates in 2D parametric space of a surface. You'll need to modify writer or do postprocessing/preprocessing if you need something else.

I want to use interleaved buffers in gltf file

There is no such an option in current implementation. Either you may use some external glTF processing tool, or suggest modifications to OCCT.

Vikas Beske's picture

Hi,

Thanks for the quick reply and help.
As you suggested we have normalized the UV data by modifying the writer.

For the Interleaved buffer I found the in the OCCT 7.7.0 we have Graphic3d_AttribBuffer class where we can have support for the interleaved buffers.
Can you confirm whether it is correct?
And if Open CASCADE supports the interleaved buffers, can you suggest a way in my use case how we can do that?
Like may in the step reader we can modify some thing to get the interleaved buffer or may be in the gltf writer while writing the buffer data construct the interleaved buffer from the normal buffer and then write it in the gltf file something like this.

Thanks

gkv311 n's picture

Graphic3d_AttribBuffer is related to visualization, while RWGltf_CafWriter is a part of Data Exchange. These two are decoupled in OCCT - it is not a big deal to create presentation with interleaved buffers nevertheless how they have been written in glTF file.

I don't know why would you want writing glTF file with interleaved buffers, but to do this directly by RWGltf_CafWriter you would have to modify it.

Vikas Beske's picture

>>I don't now why would you want writing glTF file with interleaved buffers
We want to load this GLTF file in some web viewers and there we observed that normal buffers are giving the bad performance, which can be overcome by using the interleaved buffers.
So we are trying to use interleaved buffers.

gkv311 n's picture

Are you sure that interleaved buffers in glTF is what you really need to improve performance? Have you already tried RWGltf_CafWriter::SetMergeFaces() and Draco compression options?

gkv311 n's picture

.

Vikas Beske's picture

Hi,
I tried the merged faces option but it is not useful for us.
I have attached two glb files.
One with the name "Draco Compressed" is generated from Open CASCADE using the RWGltf_CafWriter with draco compression options.
I loaded this glb file in the Three.js and applied the material with the Texture but I am not getting the results as expected.
You can refer the file with name "Applied material with Texture" for results.
The original texture image is also attached.
Can you tell me where might be the problem.
Because when we are applying the texture on Gltf file exported by Three.js it is working as expected.

Vikas Beske's picture

Hey there,
I sniffed around but can't seem to figure out where in the structure actual UV data is generated,
Could you please point me towards the method or file that generated the UV and other data for the provided STEP file!

Regards