facebookincubator / FBX2glTF

A command-line tool for the conversion of 3D model assets on the FBX file format to the glTF file format.
Other
2.1k stars 332 forks source link

don't output floats as doubles #174

Open zellski opened 5 years ago

zellski commented 5 years ago

Given that we store everything in RawModel as floats, we should not then output them as if they had meaningful double-precision data. We just end up with deceptive ugliness like

        "metallicFactor": 0.200000002980232,
        "roughnessFactor": 0.300000011920929

We should investigate explicitly serialising to JSON in single precision.

lexaknyazev commented 5 years ago

Technically, JSON has only double-precision floats. So deserializing truncated values would yield different output unless loader also uses single-precision floats internally.

zellski commented 5 years ago

I think the FBX SDK is largely concerned with doubles. I'm not sure why FBX2glTF truncates everything to single precision -- if there's any reason I should maintain that. I don't expect this tool to be run on tiny memory-strapped machines...

zellski commented 5 years ago

I guess the question is whether to turn the whole FBX2glTF pipeline doubles-friendly -- which would be fine for 99% of use cases, but could cause memory issues for really gigantic models -- or, if we have to truncate at some point, it's more honest to output with only as much precision as we can still claim to have.