how does <MinFilter=Linear> work in DirectX?

Started by
4 comments, last by TomKQT 10 years, 3 months ago

The MSDN says: D3DTEXF_LINEAR Bilinear interpolation filtering used as a texture magnification or minification filter. A weighted average of a 2 x 2 area of texels surrounding the desired pixel is used. http://msdn.microsoft.com/en-us/library/windows/desktop/bb322811(v=vs.85).aspx
Is the weight of each texel is always 0.25 when MinFilter=Linear is set and the pixel is larger than the projected texel? If not ,how does DX calculate the weight of each texel? thanks~~

Advertisement

There's a fairly comprehensive explanation along with some sample code at http://en.wikipedia.org/wiki/Bilinear_filtering

Essentially the weights are chosen based on the distance of the sample point from the centre of the nearest 4 texels.

I believe the minfilter is used when a texture gets "zoomed out" (minified) and magfilter for when it needs to be "zoomed in" (magnified). Based on the resulting size of the ploygon being rendered, with the texture.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

the

There's a fairly comprehensive explanation along with some sample code at http://en.wikipedia.org/wiki/Bilinear_filtering

Essentially the weights are chosen based on the distance of the sample point from the centre of the nearest 4 texels.

thanks, so both magfilter and minfilter use bilinear filtering,the weight calculating algorithm is the same between them

The filtering method that's used depends on how you set it.

For exampled, if you set (pseudo code)

MIN_FILTER = point

MAG_FILTER = linear

Then the type of filtering for minifying and magnifying are different

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

The term bilinear texture filtering is often used to say that both min and mag filters are linear. It's very common in graphics settings dialogs in games, you usually can choose from three options

Texture filtering: Bilinear / Trilinear / Anisotropic.

And in the code, the first option (bilinear) means:

MIN_FILTER = linear

MAG_FILTER = linear

MIP_FILTER = point

And the second option (trilinear) means:

MIN_FILTER = linear

MAG_FILTER = linear

MIP_FILTER = linear

This topic is closed to new replies.

Advertisement