Jump to content
  • Advertisement
Sign in to follow this  

Samplers and filtering.

This topic is 3091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm thinking that when I define a sampler in my shader, for example:

sampler TextureSampler =
Texture = <MyTextureMap>;

MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;

AddressU = Clamp;
AddressV = Clamp;

I should get a result that looks like it's been linearly filtered. I don't. So I add the following to the code:

device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);

... and now I get the desired result. So my question is, in the first case what is the purpose of MipFilter, MinFilter and MagFilter?

As a follow up question (:p), I've got a shader that palettizes a luminance map. It does this by reading the luminance value, splitting it into a U and a V (high byte/low byte) and doing a lookup on a palette texture to get the desired colour for the given luminance value (although I say luminance, it's an ARGB with 16 bits of luminance in GB). When I apply the above filtering to the luminance sampler (LINEAR), the result looks like I've applied some kind of edge detection to it, or Sobel filter! I know it's a long shot, but I'm hoping someone's seen artifacts like this before. POINT and LINEAR images below:





Share this post

Link to post
Share on other sites
Are you using an effect, or are you just compiling raw shaders?

Share this post

Link to post
Share on other sites
Raw shaders will ignore anything beside of the pure HLSL shader code. Anything that is state related will only be used by the effect framework.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!