DirectX118- Deep Testing and Z-Caching (Deep Caching)

  • Tags : directx11
  • time :

Microsoft provides deep caching (Z-cache) with deep testing technology to achieve occlusion relationships between objects. .

Deep testing is similar to a well, where each object is assigned a depth value. The deeper the object, the farther it is from the wellhead, and the shallower the depth, the closer it is to the wellhead. Shallow objects will obscure deep objects
The depth of the wellhead is the Z-coordinate value of the object's matrix in world coordinates. .

Depth buffer (Z-cache), used in Direct3D to store (only store depth information) drawn to the screen Each pixel point A memory buffer for depth information, if the screen resolution is 800 * 600 pixels, then the size of the depth cache is also 800 * 600.

When D3D renders the scene onto the target surface, it uses a depth buffer to determine the occlusion relationship before and after each polygon pixel after rasterization, and ultimately determines which color value will be drawn
D3D determines whether to draw the current pixel by comparing the depth of the pixel being drawn with the depth of the corresponding depth buffer point. If the result of the depth test is true, draw the current pixel and update the depth buffer with the depth of the current pixel point
The depth buffer corresponds to a two-dimensional area of screen size. .