I can’t match the result of a simple texture fetch in a regular material and my debug view mode shader. This problem only occurs when using default texture filtering. How can I get anisotropic filtering to work in my shader?
According to BaseDeviceProfiles.ini, the default settings for texture filtering are
MinMagFilter=aniso,MipFilter=point
To match this I set TStaticSamplerState to SF_AnisotropicPoint when binding the texture hoping to get the same result as my material
FRHISamplerState* SamplerStateLinear = TStaticSamplerState<SF_AnisotropicPoint>::GetRHI();
ShaderBindings.AddTexture(Shader.MipLevelTextureParameter, Shader.MipLevelTextureSampler, SamplerStateLinear, GEngine->TextureMipmapLevelTexture->Resource->TextureRHI);
Here is a comparison of the result, a default material and debug mode shader result using different texture filter and TStaticSamplerState settings.
The nearest and trilinear settings work fine. But anisotropic only works in a normal material, and not in a debug view mode. SF_AnisotropicPoint and SF_Trilinear look the same.
Both materials only do a basic fetch from a texture with custom mips where mip 0 is black, mip 7 is white, and the other mips are linear values between them, to check the rendered mip level. I sample this texture in a debug view mode pixel shader. This is the texture I used.
Is there something I can change, for example in DebugViewModeRendering.cpp to make anisotropy work? I need this for debugging texture mips and resolutions.
Thanks,
Michael