DX12 Texture min filter not working

Recommended Posts

I am trying to set up my sampler correctly so that textures are filtered the way I want. I want to use linear filtering for both min and mag, and I don't want to use any mipmap at all.

To make sure that mipmap is turned off I set the MipLevels to 1 for my textures.

For the sampler filter I have tried all kind of combinations, but somehow the mag filter works fine while the min filter doesn't seem to work at all. As I zoom out there seems to be a nearest point filter.

Is there a catch in Dx12 that makes my min filter not working?

Do I need to filter manually in my shader? I don't think so since the mag filter works correctly.

My pixel shader is just a simple texture lookup:

textureMap.Sample(g_sampler, input.uv);


My sampler setup looks like this (SharpDX):

sampler = new StaticSamplerDescription()
{
Filter = Filter.MinMagLinearMipPoint,
ComparisonFunc = Comparison.Never,
BorderColor = StaticBorderColor.TransparentBlack,
RegisterSpace = 0,
};

Share on other sites

You've understood one thing wrong - how the magnification and minification filtering works.

During magnification the number of texels you need to read per pixel processed is always 1 (in case of point filter) or 4 (in case of bi-linear filter).

During minification - the further away the object is, the more texels from original texture are in single pixel ... it is possible that if your object fits in one pixel, all texels would require to be read for that pixel (in case of implementation that doesn't require mipmaps - such implementation is NOT Direct3D) - that would be too slow, so what you require are mipmaps for the texture.

So, you require mipmaps for your minification filtering to work.

Share on other sites

Ok. I thought that the min filter would sample the texture at 4 points (bi-linear) for very pixel... and by using mipmap you can avoid those four samples and replace them with just one lookup.

So how does min filtering work? What does it mean when I specify that the min filter should be linear? Even now when I read the description of min filter it's not entirely clear.

Does the min filter sample from different mipmap levels? Then what does the mipmap filter specify? Is that just for how the mipmap should be generated?

Share on other sites

Linear means 4 corner and bilinear interpolation, period, either magnification or minification. The only difference is that relative to your screen, magnification will hit the same 4 corners and produce a smooth interpolation, while under minification, each screen pixel will hit texels far away from each other, but each pixel will still interpolate between the 4 neighbors.

Your only way to have performance and not a mess of aliased texel is to generate mip maps offline. The mip maps are nothing more than an offline pre-convolution to respect the rule of signal processing. ( display need at least twice the resolution of the signal to prevent aliasing ). That process is offline because as you can imagine, the GPU does not have the power to integrate for each pixel to draw, large area of the texture

Create an account

Register a new account

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 9
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633717
• Total Posts
3013515
×