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 working on a graphics engine that lets you walk around a world that is made up of cubes (voxel engine) and I'm having some difficulties getting the results I want.

I'm not the best at 3D graphics, but I'm willing to learn. When I have anti-aliasing turned off, the textures lign up properly together on the surfaces, but when I turn it on, I see a lot of lines between each square face. I've taken a picture:

http://img813.imageshack.us/img813/4678/screenshotlt.png

I've tried changing the mip map mag filter options on the sampler, but cannot get it to look right. I've tried increasing the quality of the textures, but that doesn't help either. When I use Linear TextureFilter but that just makes everything super blurry, and the edges are even more obvious. In fact many edges get some blurry white and dark color to them. Anisotropic doesn't help.

Nothing I do seems to get rid of those lines in between faces when I have AA turned on. Anyone have any advice on where I would start looking? I'm assuming it's because all of the faces are individual, and not mixed together when they are next to eachother. Not just the edges are being anti-aliased. Not sure if I'm even on the right track with that thought.

Any help would be appreciated. I'm using XNA 4.0 to do this.

share|improve this question

1 Answer 1

Without seeing any code it's hard to guess, but here are two three major pitfalls to look out for:

  1. On 3D graphics hardware, the edges of adjacent polygons are only guaranteed to align 100% if their vertices are 100% the same. So if you generate the vertices for each cube individually, and you use an algoritm that introduces tiny floating point errors... *boom* there could be tiny cracks all over the place at any time. Make sure to re-use vertices where possible, or at least re-use their exact floating point position.

  2. Are the textures used for each cube subtextures? In that case, try setting the AddresU/AddressV TextureAddressMode to Clamp.

  3. Are the textures used for each cube subtextures? Do the u,v coordinates match the exact corners of the subtexture without any additional padding? In that case, mipmapping is biting you. Especially the further-away tiles are sampled from the 2x downscaled mipmap, so your neatly fitting u,v coordinates now include part of the pixels from the adjacent area's (i.e. bleeding). As a quick test, assign a new sampler state and set

    state.Filter = TextureFilter.Point;

share|improve this answer
    
Thanks for replying! Yes the textures are for each cube subtexture, and i tried clamp, which cleaned up the lines a little bit, but not enough. Still have major lines especially in the distance. –  user1104203 Mar 6 '12 at 13:26
    
I'll verify vertex positions and come back to this answer. –  user1104203 Mar 6 '12 at 13:32
    
It doesn't seem to be the vertex positions. Mind you, the vertices are not literally the same, but their values are exact. One of the reasons it's easy to see, is because they are all whole numbers (it's all cube faces of size 1x1x1) any other ideas? It seems to be something with the texture perhaps? –  user1104203 Mar 9 '12 at 3:56
    
Ah, integer coordinates rules out floating point mismatches. Could you post your larger image? Oh shoot, brainwave, mipmapping. Updated answer. –  Paul-Jan Mar 9 '12 at 19:14

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.