gltf-rs / gltf

A crate for loading glTF 2.0
Apache License 2.0
535 stars 124 forks source link

`gltf_json::extensions::material::Volume` produces incorrect null when serialized #364

Open kpreid opened 1 year ago

kpreid commented 1 year ago

The KHR_materials_volume extension specifies that attenuationDistance is an optional number, with the default being infinity. But if a gltf_json::extensions::material::Volume is serialized with attenuation_distance: AttenuationDistance::default(), the output contains JSON null instead of omitting the field. This is rejected by gltf::import() and other glTF validators.