Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this weird effect when rendering small objects at a long distance. I already tried using anisotropic filtering but maybe I am not doing it right.

Material script:

material Platform/Border
      ambient 0 1 0.824 1.0
      cull_hardware none
      cull_software none 
      lighting on
        filtering anisotropic
        max_anisotropy 8
        texture white-pixel.png


first screenshot

second screenshot

How to solve this?

share|improve this question
Are you talking about the edges of the cuboids missing? Looks like mipmapping issues. – Byte56 Aug 27 '13 at 18:39
@Byte56 Yes, the edges look distorted (some parts are black where they should be greenish) – Pacha Aug 27 '13 at 18:47
And it changes based on the distance and angle of the camera? Check out this question:… – Byte56 Aug 27 '13 at 18:48
For this kind of look I imagine you'd get better results by drawing the edges explicitly using lines, rather than relying on a texture. – Nathan Reed Aug 27 '13 at 18:53
@Pacha Can you edit the question to describe more how you're building the boxes? If the edges are done with polygons, it might help to make them wider as the box gets further away, trying to ensure they always appear at least 1 pixel wide on screen. – Nathan Reed Aug 27 '13 at 20:05
up vote 3 down vote accepted

This will happen if you use textures for outlines instead of actual primitives (i.e. lines). You are fighting with twice the aliasing when you use textures to achieve this.

First the sample rate of filled primitives decreases with distance given perspective projection and second the effective sample neighborhood used for texture filtering becomes larger with distance. It can become so large, in fact, that a thin (i.e. single-texel wide) detail is completely lost despite filter interpolation.

The ideal solution would be to implement bilateral filtering for your textures (this usually gives better results than even SSAA or MSAA in this special case), but the far simpler solution is simply to use lines for the outline. Alternatively, you could use a technique I have outlined in an answer on Stack Overflow.

Now, since you're using Ogre, I have a feeling that none of the more sophisticated solutions I outlined are going to work for you. One last ditch effort would be to exaggerate the width of the border in your outline texture in lower mipmap levels (assuming Ogre gives you control over the mipmaps). Also make sure you use a clamp to edge address/wrap mode.

I should also point out that if Ogre lets you control mipmap LOD bias, you might try a negative bias for the outline texture.

share|improve this answer

Your Answer


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.