Revision aaa552a4b9cbf9dccb71450f47b268e0ed6370e2 authored by Artem Kharytoniuk on 11 April 2020, 18:46:33 UTC, committed by Matt Pharr on 26 June 2020, 22:19:21 UTC
A texture footprint with 'width' characteristic size corresponds to texture
sampling rate with 1 sample per screen pixel. In order to satisfy the Nyquist
limit we need a filter of size '2*width' - and that's what we have in the original
code. This computation does not take into account though, that after computing
lod and selecting mip levels, we apply bilinear filtering to sample each mip.
This effectively increases filter size to '4*width' which results in too blurry images.

There could be at least two solutions here: the first one is to use '2*width' filter size
and then use point sampling when working with separate mip levels. Another solution
proposed here is to select the mip levels based on the 'width' filter size and then rely
on bilinear filtering to get correct result.

I didn't check this but the second method could provide better results because the last step
when we apply bilinear filtering takes into account specific use case and in the case of
point sampling the final result is baked into the mip level, so we don't have an opportunity
to select proper position between texels as we do with bilinear filtering.

The proposed solution also matched HW filtering results, for example, in this
project, the RTX raytracing code
computes texture lod using just 'width' and then applies bilinear filter. The result
closely matches rasterization version. Color encoding of lod levels used in that demo
allows to visualize differences in lod selection. By modifying the code to use '2*width' it
can be shown that is produces wrong result.
1 parent 9629f11
File Mode Size
.gitignore -rw-r--r-- 47 bytes
.gitmodules -rw-r--r-- 369 bytes
.travis.yml -rw-r--r-- 827 bytes
CMakeLists.txt -rw-r--r-- 15.9 KB
Dockerfile -rw-r--r-- 340 bytes
LICENSE.txt -rw-r--r-- 1.3 KB -rw-r--r-- 6.0 KB
appveyor.yml -rw-r--r-- 931 bytes

back to top