pasgltf
pasgltf copied to clipboard
For perspective camera, specifying zfar is not required
Loading a model from https://poly.google.com/view/9Vq_-HEtIHA (downloaded version using "Updated GLTF file") raises an error
Invalid GLTF document, missing "zfar" field
Indeed, glTF file doesn't specify zfar:
"cameras" : [
{
"perspective" : {
"yfov" : 0.7853981633974483,
"znear" : 0.1000000014901161
},
"type" : "perspective"
}
],
Looking at glTF 2.0 specification, zfar is not required for perspective cameras: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-perspective . It says "Required: No" and "If zfar is undefined, runtime must use infinite projection matrix." . But PasGLTF requires it, by reading it through Required
function,
result.fPerspective.fZFar:=TPasJSON.GetNumber(Required(....
on https://github.com/BeRo1985/pasgltf/blob/master/src/PasGLTF.pas#L4050 .
Also aspectRatio
is not required, according to the glTF 2.0 specification, but PasGLTF code makes it required.
Note that zfar
is still required for orthographic cameras, which may explain why this bug appeared :)