I had exported a glTF model from blender, when I put .bin file to hex editor, it seems his vertices, UVs and normals are in "4 bytes" float, or IEEE 754 floating point, like the example below.
Is it possible to export glTF models with short_signed not float, or "2 bytes" only, not "4 bytes" in the vertices, UVs and normals?
Example:
Vertices are in float:
X = 34 80 45 C2 ----short_signed----> xx xx
Y = C1 F9 65 42 ----short_signed----> xx xx
Z = 94 F6 76 41 ----short_signed----> xx xx
UVs are in float:
X = AD 69 0E 3F ----short_signed----> xx xx
Y = 5D FE 63 3F ----short_signed----> xx xx
Normals are in float:
X = 66 96 66 BF ----short_signed----> xx xx
Y = 56 66 DE 3E ----short_signed----> xx xx
Z = 00 00 80 3F ----short_signed----> xx xx
If it is impossible, please give me any method to convert this "4 bytes" float hexadecimal to "2 bytes" only, and make it short? (IEEE 754 floating point --------> signed short)
Or is there another model format with signed short, or "2 bytes" in the vertices, UVs and normals?
Thanks in advance.
Although Blender's exporter does not give full control over the binary data layout, the glTF format have some flexibility for allowing uint16, int16, and other array types. You can get pretty close to the result you're asking for with a tool that does quantization, gltfpack:
gltfpack -i input.glb -o output.glb -vn 14
As of gltfpack v0.14, by default normals are int8; the -vn 14
option above changes that to int16. By default vertex positions are uint16, and UVs are int16. Note that this tool also interleaves vertex attributes.