Game engine: visibility judgment

xiaoxiao2021-03-06  105

Visual judgment refers to: It is possible to quickly calculate a scene in a scene in a scenario, and rendering the visible portion in the scene in accordance with a given camera location and direction. The visibility judgment is mainly determined by the following types of judgment: 1. Judgment the front and back of the triangular surface. The front and background of the triangular shape is determined by the hand-oriented: the left hand coordinate system: the three vertices of the triangular surface are arranged in the direction of the normal direction, and the normal direction is opposite to the opposite direction. Right-handed coordinate system: three vertices of the triangular surface are arranged in counter-hour, and the front side is in the direction of the direction, and the normal direction is opposite to the opposite direction. Judging the front and background of the triangular surface is called: 2D Back-Face Culling (2D back pick). 2. Judgment the face in the geometry. Depending on the position where the camera is located, the face is blocked by other faces in a geometry. The algorithm that judges that the face in the geometry is called: 3D Back-Face Culling (3D Background Pick). 3. Judge the occlusion between the geometry. The geometry of the 3D space can be completely or partially obscured by other geometry. 4. Judging whether the geometry is within the scope of the view. The geometry that is not in the range of view will be removed from the rendered pipeline and will not be rendered.

As can be seen, the visibility is determined to be layered. It can generally be divided into the following levels: 1. Pixel-Level VSD, pixel visibility judgment. This judgment is in the GPU phase, the GPU uses the value in the depth buffer, called the z-buffer, to determine the occlusion of the pixel. 2. Triangle-Level VSD, triangular top-level visibility judgment. This judgment can be at two different phases: in the GPU phase, the GPU executes 2D back-face cull; in the CPU phase, the CPU performs 3D back-face culling.3. Object-Level VSD, geometric grade visibility. This judgment is in the CPU phase, and the CPU determines whether the occlusion between the geometry and the geometry are in the view. 4. Area-Level VSD, regional grade visibility judgment. This judge is in the CPU phase, by means of a region in the scene into some data structures, such a set of geometry can be separated from the visual set. The main algorithm is spatial segmentation, including: quadtree, topic tree, two fork spatial sections. 5. Scene-Level VSD, the scene-level visibility judgment. This judgment is in the CPU phase, and the object that is determined is multiple scenes, and the unacceptable scene will not be rendered. The main algorithms used in different phases are briefly described below: 1. Pixel-Level VSD The main algorithm here is Z-Buffer, there is a depth buffer storage area in the GPU, saved is the depth of the pixel level. Information, and color information of pixels are the relationship between a position. When rendering, compare the depth information of the existing pixels and the depth information of the new pixels, if a certain condition is satisfied, the color information of the new pixel will replace the original color information, the depth of the new pixel Information will also replace the original depth information. 2. Triangle-Level VSD The algorithm mainly used here is the point of calculation of the direction vector and the direction of the camera, and the plan method is supplied to the direction vector view C, then: Dot (n, c) > = 0 is visible; DOT (N, C) <0 is not visible; 3. Object-level vsd at this level, according to the task, it can be divided into: 1.frustum cooling: Deconstimate whether a geometry is in an eye The geometry that is not in the intercepts will be removed. 2. Object Culling: Judging the occlusion problem between geometry, the geometry that is completely blocked by other geometry will be removed. 3. Detail Culling: Depending on the distance from the geometry and the camera position, use different degrees of detail information to render geometry. 4.Depth cooling: According to the distance from the geometry and the camera position, the geometry that is a certain distance from the camera will be removed. 4. AREA-Level VSD The algorithm mainly used here is to describe the spatial segmentation after a certain data structure, commonly available: quadrushing trees, topic trees, two forked spatial sections. 4.1 Bice Tree 4.1.1 The structure of the top tree first constructs a cube that minimizes all the geometries in a region of the entire scene or scene, which uses this cube as the root of the topic tree (root). The cube box is then divided into a small cube of eight equal sizes, which are further divided into eight smaller sizes. The cube produced during the execution of the process becomes an octave, and each octa is connected to the cube box generated, each geometric object in the scene is connected to the eight-component that completely contains it. In this structure, the intermediate node is indicated by the eight-component of the geometry, any empty octave (ie, an eighth component that does not contain any geometry is removed), each leaf node representation is a geometry.

转载请注明原文地址:https://www.9cbs.com/read-97401.html

New Post(0)