Nvidia in this article presented a way to upsample low res buffer to full res buffer called Nearest Depth Upsampling.

This works by comparing four depth values from downsampled low res depth buffer with current value of full res depth buffer and selecting texcoords where difference is minimal to sample the low res buffer.

In the article they stated the four places to sample as "bilinear footprint of the current full res pixel".

In the picture, the circle marks the texcoord of one of the fragments of full res buffer. So if full res is 4x4 then low res is 2x2.

enter image description here

Unfortunaltely it is not clear to me how to sample the low res buffer correctly. My question are:

  • What are locations of the four samples used to sample low res buffer in relation to current texcoords of full res buffer?
  • Is downsampling depth using just hardware interpolation is enough?
  • Can I upsample not only half res buffer but also quarter res buffer to full res?
  • $\begingroup$ If you use glsl function textureGather (or DX11 GatherRed) at the same coordinates, it will return the values for 4 contiguous texels. You can then compare these values to the full-resolution depth buffer depth value, and find which is closest. $\endgroup$
    – wip
    Nov 6, 2020 at 3:11
  • $\begingroup$ For a quarter resolution buffer, I see 2 possible approaches: A) Do it in two steps: first upscale your quarter-resolution buffer into a half-resolution buffer, then upscale the half-resolution buffer into a full-resolution buffer. With this approach you can use the sme formula as above. B) Do it in one step: in this case you need to sample 4x4 texels in the quarter-resolution buffer, and compare their values with the target full-resolution depth buffer depth $\endgroup$
    – wip
    Nov 6, 2020 at 3:17
  • $\begingroup$ This presentation seems to have a few slides presenting "bilateral upsample" that looks related: gdcvault.com/play/1022982/… $\endgroup$
    – wip
    Nov 6, 2020 at 3:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.