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 331 forks source link

invalid output of merged ao_met_rough when no ao supplied #276

Closed rdpeake closed 3 years ago

rdpeake commented 4 years ago

if you supply a model which does not have an occlusion map, but do have met and rough - the combined result at https://github.com/facebookincubator/FBX2glTF/blob/4b501431fec2fb0049d24edde8ff400d408ce7e6/src/gltf/Raw2Gltf.cpp#L280 seems to produce an invalid output for the ao_met_rough file

rdpeake commented 3 years ago

suggest changing https://github.com/facebookincubator/FBX2glTF/blob/4b501431fec2fb0049d24edde8ff400d408ce7e6/src/gltf/Raw2Gltf.cpp#L289

with

const float occlusion = (*pixels[0])[0] * (hasOcclusionMap ? 1 : 0);

or use the props object if that is supported for occlusion in place of the ending 0

rdpeake commented 3 years ago

This turned out to be invalid due to a difference in what input files i was actually using