I've seen a lot of questions and answers on different forums regarding the visual difference between different texture filtering methods (bilinear/trilinear/anisotropic2x etc), but I've not been able to find any info on the cost in texture taps, ALU etc. I guess this might be because the cost is highly dependent on the hardware and/or graphics API being used...? Can someone speak to the cost of these different texture filtering methods? If it is hardware dependent, can any general relationships be extrapolated (other than bilinear is cheaper than trilinear is cheaper than anisotropic)? If not, can someone explain what hardware/API features factor most heavily into the costs of these filtering methods?
Asked
Active
Viewed 2,662 times
2
-
It is dependent on hardware for sure, not so much API. D3D and OpenGL are pretty lenient on how texture filtering is implemented (e.g. linear filtering is defined as a weighted average of 4 nearest neighbors; the precision of weighting, etc. is left undefined). This is why drivers have quality/performance settings independent of API for things like anisotropic and trilinear filtering. The cost of filtering these days is basically the expense of fetching texels, new GPUs are designed to fetch 4 texels at a time in order to make linear filtering quicker, evident by `gather4` in Shader Model 4.1+ – Andon M. Coleman Sep 30 '13 at 21:46
-
Sorry if this is graphics 101 stuff...trying to get up to speed a little:So in general, how many additional fetches does it take to do trilinear as opposed to bilinear filtering or anisotropic filtering (2x, 4x etc)? Assuming there is the hardware will only fetch one texel per sample call, what is the relative cost in fetches (since it seems ALU isn't a factor) between these methods? I assume this can be extrapolated from the algorithms for these filters but I'm not familiar with them (searching online for some implemenations now). – user1200340 Oct 01 '13 at 00:56
-
2I could not honestly say in general how many more fetches are required. Trilinear filtering is used to filter across mipmap LODs, which generally varies by distance. Anisotropic filtering kicks in when textures are sampled at irregular angles. Anisotropic filtering increases the sample neighborhood size (from 4 texels in bilinear to potentially many more depending on the shape of the sampled region) so its expense is hard to characterize. If everything is sampled at right angles (for instance, stretching a texture over a viewport) no anisotropy is present; good drivers can skip the extra work. – Andon M. Coleman Oct 01 '13 at 03:54
-
2Have a look at this site for more details: http://www.arcsynthesis.org/gltut/Texturing/Tut15%20Anisotropy.html. The general idea with anisotropy is that you are defining the most samples allowed in the absolute worst-case. When the degree of anisotropy is low, the actual number of samples may be very small. – Andon M. Coleman Oct 01 '13 at 04:09
-
I'll take a look at that link, thanks for the info Andon! – user1200340 Oct 01 '13 at 16:54