Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm a bit confused here and maybe someone can explain this to me. I created a simple test texture for my terrain which is nothing more than a solid green color with a black grid overlayed on top of it. If I look at the terrain in the distance with mipmapping on and linear filtering, the grid lines become blurry fairly quickly and further back the grid is pretty much invisible. With these settings, I don't get any moire patterns at all. If I turn on anisotropic filtering, however, the higher the anisotropic level, the more the terrain looks like it did with without mipmapping. The lines are much crisper nearby but in the distance I start to see terrible moire patterns.

My understanding was that mipmapping is supposed to get rid of moire patterns. I've always had anisotropic filtering on in every game I play and I've never noticed any moire patterns as a result, so I don't understand why it's happening in my game. I am using logarithmic depth however, could that be causing any problems? And if it is, how do I resolve it?

I've created my sampler state like so (I'm using slimdx):

ssa = SamplerState.FromDescription(Engine.Device, new SamplerDescription
{
       AddressU = TextureAddressMode.Clamp,
       AddressV = TextureAddressMode.Clamp,
       AddressW = TextureAddressMode.Clamp,
       Filter = Filter.Anisotropic,
       MaximumAnisotropy = anisotropicLevel,
       MinimumLod = 0,
       MaximumLod = float.MaxValue
});

Point Filtering Point Filter

Anisotropic 1 enter image description here

Anisotropic 8 enter image description here

Anisotropic 16 enter image description here

Anisotropic 16 at an angle enter image description here

share|improve this question
    
Could you post a screenshot of the patterns you get with anisotropic filtering on? –  Nathan Reed Jun 8 '12 at 5:32
    
@NathanReed Done –  Telanor Jun 8 '12 at 5:43
    
Thanks. Interesting pictures. I'm not completely sure what's going on, but I wonder if hardware aniso simply doesn't work well with a texture like this. Aniso is, after all, just another approximation, like mipmaps. I wonder if something like EWA would fare better? –  Nathan Reed Jun 8 '12 at 6:12
    
Would the fact that I'm using a texture atlas cause this? –  Telanor Jun 8 '12 at 7:12
    
As in, the green square is only a sub-rectangle within a larger image? Yeah, I could definitely see that causing issues - mipmapping in general doesn't work well with texture atlases. –  Nathan Reed Jun 8 '12 at 16:23

1 Answer 1

up vote 3 down vote accepted

Would the fact that I'm using a texture atlas cause this?

Anisotropic filtering only works within a topologically continuous surface. Two adjacent triangles that share an edge position-wise, but have different texture coordinates are not topologically continuous. And thus, aniso won't work very well between triangles.

Just use mipmap filtering.

share|improve this answer
    
I had a feeling that might be it. I'll try using a texture array instead of a texture atlas and see if I get better results with that –  Telanor Jun 8 '12 at 23:17
    
@Telanor Technically, using a texture array is by far the better solution, but you can also take a look at this alternative solution that might work. –  danijar Aug 27 '13 at 23:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.