Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For perspective camera, specifying zfar is not required #4

Open
michaliskambi opened this issue Apr 1, 2020 · 0 comments
Open

For perspective camera, specifying zfar is not required #4

michaliskambi opened this issue Apr 1, 2020 · 0 comments

Comments

@michaliskambi
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant