<p>Nvidia in <a href="http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/OpacityMappingSDKWhitePaper.pdf" rel="nofollow noreferrer">this article</a> presented a way to upsample low res buffer to full res buffer called Nearest Depth Upsampling.</p>

<p>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.</p>

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

<p>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. </p>

<p><a href="https://i.sstatic.net/JFfPw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JFfPw.png" alt="enter image description here"></a></p>

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

<ul>
<li><strong>What are locations of the four samples used to sample low res buffer in relation to current texcoords of full res buffer?</strong></li>
<li><strong>Is downsampling depth using just hardware interpolation is enough?</strong></li>
<li><strong>Can I upsample not only half res buffer but also quarter res buffer to full res?</strong></li>
</ul>

CC BY-SA 4.0
2020-11-06T03:11:19.503Z
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.
wip
CC BY-SA 4.0
2020-11-06T03:17:33.367Z
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
wip
CC BY-SA 4.0
2020-11-06T03:18:37.487Z
This presentation seems to have a few slides presenting "bilateral upsample" that looks related: https://www.gdcvault.com/play/1022982/Mixed-Resolution-Rendering-in-Skylanders
wip
<texture><glsl><sampling><supersampling>
Nearest depth upsampling
mdkdy
# Nearest depth upsampling

(Asked by: username_0 on 2017-08-09)

Nvidia in [this article](http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/OpacityMappingSDKWhitePaper.pdf) 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](https://i.sstatic.net/JFfPw.png)](https://i.sstatic.net/JFfPw.png)

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?**

**Tags:** texture, glsl, sampling, supersampling

> **Comments:**
> **username_1**: 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.  
> **username_1**: 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  
> **username_1**: This presentation seems to have a few slides presenting "bilateral upsample" that looks related: https://www.gdcvault.com/play/1022982/Mixed-Resolution-Rendering-in-Skylanders  

---

## 0 answers

