What calcules can I do to make far objects looking better?

My game

Here's what I see if I go back with the camera in my test-rendering scene:

enter image description here

As you can see the result is not one of the bests: borders are not defined well and the texture itself is not nice to see.


Here's for example an image of Minecraft far blocks rendering:

enter image description here

As you can see the result is better than mine. Minecraft seem blurring far blocks or something like that.


This is another game cube-based called Trove.

enter image description here

Here I appreciate how it defines block borders by treading them with a black line.



(I know that lights make their part in graphical improvement but I think that there is something more in mc and trove shaders)

1) How can I blur texture like Minecraft does? (I don't know actually if its a blur)

2) How can I highlight borders of the block like Trove does?

P.s: I'm using OpenGL 3.1+!

  • 2
    \$\begingroup\$ The artifact you're encountering is something called spatial aliasing. Your textures have more texels than you have screen pixels to draw them on at that scale, so some texels get skipped over and the result is a speckled/sparkly appearance. Games typically solve this through mipmapping their textures, using lower-res images for distant geometry, simulating the averaging of colour within a single camera photosensor cell. Here's a visual example \$\endgroup\$
    – DMGregory
    Feb 2, 2017 at 21:30

1 Answer 1


What you see is there because the textures are in a higher resolution than what they get drawn in. This results in a very pixelated look.

To "fix" this you can generate mipmaps. Mipmaps are the smaller versions of the texture, they get drawn instead of the original size when the surface is smaller. This results in a smoother looking texture when it's farther away.

There is however one problem with mipmaps. They make the textures look blurry when they're at an angle closer to the camera. At these places OpenGL uses the smaller versions even though the surface horizontally is closer to the original size. If you use OpenGL 2+, then you can use the anisotropic filtering extension for this (GL_EXT_ANISOTROPIC)

To generate mipmaps, you need to call glGenerateMipMaps(int tex), then use GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR or GL_NEAREST_MIPMAP_NEAREST when you set the minimum filter (you can't use this for the maximum filter). The first linear or nearest tells you how it interpolates between mipmaps, the second tells you how it interpolates between pixels. For a minecraft-like game, you should use GL_LINEAR_MIPMAP_NEAREST.

Highlighting blocks is usually done in a post processing shader. Render the normals to a texture, then sample each fragment in an x by x area, and if somewhere there's a change in the normals, then there's an edge. If you don't want edges around the cubes, then do the same with the depth.

  • \$\begingroup\$ Could you explain better the highlighting blocks process? Ty, really nice answer though! \$\endgroup\$
    – loryruta
    Feb 4, 2017 at 5:22
  • \$\begingroup\$ @loyruta look up a post processing tutorial, explaining that is way beyond the scope of this site \$\endgroup\$
    – Bálint
    Feb 4, 2017 at 6:49
  • \$\begingroup\$ For post rendering you mean operations on a custom framebuffer? \$\endgroup\$
    – loryruta
    Feb 4, 2017 at 7:00
  • \$\begingroup\$ @loyruta on creating the framebuffers, rendering to them and using it again \$\endgroup\$
    – Bálint
    Feb 4, 2017 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .