Is there any particular reason that you're using the Minecraft default textures? It may be acceptable if it's just a placeholder whilst you do testing, but if you use those graphics anywhere outside of your computer there are copyright issues (as they aren't your graphics).
–
PolarMar 16 '13 at 16:09

If you are going to implement a deferred renderer, a post processing anti aliasing would blur these artifacts away. I am not sure what rendering technique you use, but I can't see any anti aliasing in your screenshot.
–
danijarMar 16 '13 at 16:28

Basaa, it would be very helpful if we had the code - at the minute all we can do is speculate. Help us help you, if you will.
–
PolarMar 16 '13 at 16:33

1

Yes, those textures are ofcourse just a placeholder. I'm just experimenting with Voxel Engines, this isn't even going to be a complete game.
–
BasaaMar 16 '13 at 16:54

3 Answers
3

I had the same problem with a recent game I'm working on. I guess you are using one big texture with all the block textures in it (like Minecraft does it)?

If so these white pixels appear because of rounding errors in the shader that lead to "empty" texture spots. This occurs even if you do not use texture interpolation (which is the case with your game obviously).

You can circumvent the problem by modifying the texture coordinates to add a little margin. This way the rounding error won't lead to a lookup outside the texture. This may not be the best solution but when it comes to float values you always have to take care of possible rounding problems.

Another way to fix that would be to use one of the more recent GLSL versions that offer a integer based texture lookup method.

If you build your meshes more carefully, ensuring you are reusing vertices wherever possible, you should be fine: That is, you must not duplicate vertices per face as then the GPU rasteriser will see them as two discrete objects and sometimes fail to rasterise the in-between space (thus defaulting to the GL's clear colour) due to floating point limitations; whereas had you shared the vertices between these same two faces, the rasteriser would have seen each fragment as either belonging to one face or to the other, but never to the space behind them (sky).

Polar rightly notes that Minecraft has these artifacts too. They are only noticeable when you are above a certain depth (y), because the sky(box) colour changes to grey/black once you hit the Deeps, so you won't notice fragments of blue sky shining through. That's one reason they're not as evident as they are in your engine.

The greater reason why your artifacts are more evident than Minecraft's is because the latter constructs RLE-based columnar meshes; that is, the stack of voxels (in y) at every (x,z) location is a single mesh rather than a mesh per block or per face (as you seem to have!), with the texture presumably procedurally generated for the the correct columnar sequence of voxel types. So in MC you won't experience noticeable sky pixels on the ground surface, or on the edges of columns, or vertically between cells; only between columns, and thus much less frequently than in your case, where you seem to have seams all over the place, including on cubes' upper edges.

(P.S. This should also greatly reduce your upload bandwidth and potentially number of draw calls.)

If you look closely at the dots, you'll see that they're all on the cube edges. The most likely explanation for this is that when you calculate the voxels positions in the viewport (screen), the rendering algorithm isn't seamless - that is, when they are converted from 3D to 2D, there are areas in the 2D which are never mapped to by the 3D world. If you're drawing the edges with a line, which is again quite likely, the line algorithm may miss out the odd pixel.

On the subject of Minecraft (see my comment about graphics and copyright on your post), Minecraft itself has these glitches from time to time - they aren't entirely unexpected. On the other hand, they can be quite annoying - I don't personally know a solution to this off the top of my head; if you really need to remove them, then you'll have to experiment, or ask someone else. Personally though, I wouldn't notice them if the game was any good - I'd be too absorbed in it to see such tiny graphical glitches.

Instead I think the artifacts are caused by rounding error of floating point vertex data.
–
danijarMar 16 '13 at 16:29

@sharethis It's possible, I agree - it would probably be best to implement your suggestion above. On the other hand, my explanation matches it up with visual glitches I've seen before (without anti-aliasing) - who knows which one is right? Of course, it would help if we had the code.
–
PolarMar 16 '13 at 16:33