Why is it difficult to efficiently calculate collisions in graphics engines?

From the oldest games to the most modern, it seems that you still see through the walls or most often the earth in some camera positions. Why is it difficult to efficiently calculate collisions in graphics engines? Is rounding / loss of accumulation accuracy leading to a misconception?

+7
source share
2 answers

This is not a collision in the explicit sense. The camera’s position is probably not actually “inside” the wall or ground in these situations, but it’s just very close to it.

In 3D computer graphics, the camera has the concept of the near plane and the background . Only the geometry located between these two planes will be visible, and the rest will be cut off. If you are too close to something and correctly align the camera, then the likelihood that some parts of the geometry will be too close to the camera, as determined by the near plane, and as a result, the geometry will not be displayed.

Now the distance to the nearest plane can be set by the developers, and it can be set very short - short enough to avoid such situations. However, the buffer depth buffer or z , which is used to determine which objects are closest to the camera during rendering, and thus which objects to render and which not to display, are closely related to long and long distances.

In graphics hardware, the depth buffer is represented using a fixed number of bits for each pixel, for example 32 bits. These 32 bits should be sufficient to accurately represent the entire gap between the near plane and the long plane. It is also not linear, but will more accurately approach the camera. As a result, selecting a very small distance near the plane will significantly reduce the overall accuracy of the depth buffer. This can cause annoying flicker throughout the scene where two objects are very close to each other.

You can read more about this problem here , as well as section 12.040 here .

+2
source

This is not about complexity (of course, it is not easy to calculate the collision / clipping of a non-convex object), but you still need to have only ~ 33 ms to calculate the entire frame, so you need to make some compromise (the collision mesh is not the same as the grid, which you really see). If there is no time for an exact solution (to fulfill all the conditions - the distance to the camera, the object you need to see, avoid collisions), you should step back to some "easy" solution, for example, see through the wall.

+1
source

All Articles