Creating a depth image
The depth image surface plays an important role in 3D graphics application. It brings the perception of depth in a rendered scene using depth testing. In depth testing, each fragment's depth is stored in a special buffer called a depth image. Unlike the color image that stores the color information, the depth image stores depth information of the primitive's corresponding fragment from the camera view. The depth image's dimension is usually the same as the color image. Not a hard-and-fast rule, but in general, the depth image stores the depth information as 16-, 24-, or 32-bit float values.
Note
The creation of a depth image is different from the color image. You must have noticed that we did not use the vkCreateImage()
API to obtain color image objects while retrieving swapchain images. These images were directly returned from the fpGetSwapchainImagesKHR()
extension API. In this section, we will go through a step-by-step process to create the depth image.