Sparkling Along Shared Edges

Hello -

I’m currently creating a first-person openGL application, and am having a bit of trouble. The world is tile based, and every tile consists of a cube at a particular height (the game is mainly going to be navigating through mazes). Anyways, when you create a row of cubes, you see sparkling between the shared edges. I have implemented a hidden surface removal procedure, so none of the faces which are between two cubes are being drawn. I thought that might take care of the problem, however, it only seemed to make it a little better. When I turn lighting off, the problem goes away completely, however, I really want to leave lighting on. I have cull back facing turned on, and two sided lighting disabled. Does anybody have any other ideas as to how I could get the sparkling to go away? Thanks!

Are all your tiles the same size and are coincident vertices (where the corners of 2 or more tiles meets), truly the same for each tile? Because it sounds like to me your problem is either T-Junctions, or variant vertices (which should be invariant).

Yes, all the tiles have the same base size (10 units in the x direction by 10 units in the z direction). The heights can vary for each one, however. Since they are all the same size on the base, I don’t see how the points could be varied - they should be the exact same… however, even on long walls, where all the boxes are the exact same height, you still get that sparkling effect. If you have any ideas as to how I could ensure the same coordinates are being used, maybe I could try that.

-lost hope

Well, the short answer is that edges which do not share enpoints aren’t guarnteed to be exactly colinear even if you specify them that way. The classic example of this is a “T junction”



even if you specify A( 0.0, 1.0 ), B( 0.0, 0.0 ), C(0.0, 0.5), D( 1.0, 0.5 )
it won’t guarantee that C is colinear with AB, so you have to be sure construct your geometry such that all junctions occour on a shared vertex.

So that explains the differing height cubes… not sure about the ones that are the same hight… are you sure that you don’t have garbage hanging around in the lower decimal places of your vertices? Weird casts, etc. can sometimes cause that…