OpenGL (ES) - What is the difference between truncations and ortho?

When I use each of them with the same parameters, the only difference I notice is how to close the "camera" from objects. What is the difference here and which is preferable for playing mostly 2D?

+7
source share
3 answers

I do not agree with LeffelMania, although his answer has already been accepted, I would like to explain again what truncation is and what are the differences between spelling and perspective projections.

A truncation is a pyramid without a 3D object in the shape of the upper part (in the link defined by the space between the zNear and zFar planes).

view frustum

Truncation is used to determine what the camera can see. Everything inside or intersecting with the camera image must be displayed, everything else can be ignored.

Since truncation is a complex form for performing intersection checks, often the matrix transform is constructed so that the representation of the truncated cone is transformed into a cube. This matrix transformation also applies to all objects in the scene, so now we can do a simple β€œintersect with cube” check. This is called the canonical view frustum ( see details here )

Now about the prospects against spelling projection. In the picture you see a camera or projection center (COP). In a perspective projection, the CS is near the near plane. Rays from all positions in the background indicate the COP. Where these rays intersect near the plane (aka viewport), the pixel is colored in accordance with the color of the nearest object to the nearest plane to which the ray fell. Perspective projection results in (multiple) vanishing points and objects farther from the camera, and parallel lines in the world are not necessarily parallel to the image.

In the orthographic projection, the CS is infinitely far, so the rays are almost parallel to each other. There is no vanishing point, more distant objects are not drawn less, and parallel lines in the world are parallel in the image.

+31
source

Generally speaking, Frustum is used for 3D scenes to accommodate perspective projection. It takes into account the distance to the object from the camera, as well as the viewing angle to determine the size and position of the object on the screen. The spelling projection simply takes each object and draws a straight line from the object to the pixel on the screen, making it just a flat scene. This is a gross generalization, and much can be said there on this issue, but for a 2D game you will want to use spelling projection.

+1
source

I'm confused. The difference between truncation and ortho is greater than projection lines. That is my understanding. Ortho is a rectangle, and the camera can move in space to see at different angles, so the limited volume is fixed during the movement of the camera. On the contrary, the truncation must be attached to the camera, otherwise you can create this cone, and then move the camera to view from the side and get an illogical look. It is right? I would think that you need ortho to say which objects to include, and truncated to say how to visualize, and only objects included in both will be visible. But I do not know if this is true. Any explanation would be appreciated.

Fernando

0
source

All Articles