Achieve anisotropic filtering

Posted by fedab on Game Development See other posts from Game Development or by fedab
Published on 2014-06-03T12:35:32Z Indexed on 2014/06/03 15:59 UTC
Read the original article Hit count: 207

Filed under:
|
|

I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#.

How do i set up anisotropic filtering in my shader?

Currently i try that in the shader:

Texture2D tex;
sampler textureSampler = sampler_state
{
  Texture = (tex);
  MipFilter = Anisotropic;
  MagFilter = Anisotropic;
  MinFilter = Anisotropic;
  MaxAnisotropy = 16;
};

float4 PShader(float4 position : SV_POSITION, float4 color:COLOR, float2 tex0 : TEXCOORD0) : SV_TARGET
{
  float4 textureColor;
  textureColor = tex.Sample(textureSampler, tex0) * color;

  return textureColor;
}

I get my object, textured, but it is not filtered anisotropic. I can write everything in the Parameters, even invalid things and i don't get any errors. The result is the same, objects without applied anisotropic filtering.

Do i have to set that in the shader? Can i do that also with SamplerState? I tested that but i didn't get a result too.

Some steps what i have to set would be helpful.

© Game Development or respective owner

Related posts about c#

Related posts about shaders