Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Trilinear interpolates across three dimensions, such as 3D textures or mip chains

I meant trilinear interpolation across the mip chain.

> generated with "some" downsampling filter (which can be anything from box to Lanczos)

In practice, whichever method is implemented in user-mode half of GPU drivers is pretty good.

> It is not a method for downsampling

No, but it can be applied for downsampling as well.

> under perspective projection of a 3D asset

Texture samplers don’t know or care about projections. They only take 2D texture coordinates, and screen-space derivatives of these. This is precisely what enables to use texture samplers to downsample images.

The only caveat, if you do that by dispatching a compute shader as opposed to rendering a full-screen triangle, you’ll have to supply screen-space derivatives manually in the arguments of Texture2D.SampleGrad method. When doing non-uniform downsampling without perspective projections, these ddx/ddy numbers are the same for all output pixels, and are trivial to compute on CPU before dispatching the shader.

> More expensive

On modern computers, the performance overhead of anisotropic sampling compared to trilinear is just barely measurable.



The problem is that your suggestion is strictly worse and unnecessarily complicated for the case discussed in the article. If you want to downsample 2x, 4x, etc, then that's just one level in the MIP hierarchy, no need to compute the rest. The point of the article however is to explain how one level in that MIP chain can be computed in the first place.

If you want to downsample 3x or fractional, then interpolating between two MIP levels is gonna be worse quality than directly sampling the original image.

Perspective (the use case for anisotropic filtering) isn't discussed in the article, but even then, the best quality will come from something like an EWA filter, not from anisotropic filtering which is designed for speed, not quality.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: