Calculating frustum FOV for a PerspectiveCamera

前端 未结 1 1337
说谎
说谎 2021-01-15 00:57

I currently have a screen consisting of two areas:

(Values are just assumed for this particular example and may of course vary depending on screen).

The scre

相关标签:
1条回答
  • 2021-01-15 01:29

    The projection matrix describes the mapping from 3D points of a scene, to 2D points of the viewport. It transforms from eye space to the clip space, and the coordinates in the clip space are transformed to the normalized device coordinates (NDC) by dividing with the w component of the clip coordinates. The NDC are in range (-1,-1,-1) to (1,1,1).
    Every geometry which is out of the NDC is clipped.

    The objects between the near plane and the far plane of the camera frustum are mapped to the range (-1, 1) of the NDC.
    (See further How to render depth linearly in modern OpenGL with gl_FragCoord.z in fragment shader?)

    This means if you want to see objects that are nearer then 1.0, then you have to set the distance to the near plane less than 1.0.

    Note, the near plane and the far plane should be as close as possible to the scene, to increase the computational accuracy and to avoid z-fighting, but they must include everything you want to see from the scene.

    0 讨论(0)
提交回复
热议问题