• entries
177
531
• views
164190

# Crap

189 views

Well I whipped up a new polygon splitter using ye old span method. It works for the most part except for hairline cracks EVERYWHERE.

The clear color is set to bright blue and it shows:

It also misses a few triangles on some levels. Now it might only be a few, but it's definitely noticeable:

Anyway I figure the cracks are caused by rounding errors. Anyone have any idea how to fix them? Here's the function to find a point on a line from the Z axis:

	public static Vertex HorizontalPlaneIntersection( Line LineReference, int Z )	{		Vertex A = LineReference.StartVertex; 		Vertex B = LineReference.EndVertex; 		int DX = B.X - A.X;		int DZ = B.Z - A.Z;		if( Math.Abs( DZ ) == 0 )		{    			return null;		    		}				if( A.Z == Z )		{			return A;		}		if( B.Z == Z )		{			return B;		}		if( A.Z < B.Z )		{			if( ( Z < A.Z ) || ( Z > B.Z ) )			{				return null;			}		}		else if( ( Z < B.Z ) || ( Z > A.Z ) )		{			return null;		}		if( Math.Abs( DX ) == 0 )		{			return new Vertex( A.X, Z );		}		float Slope = (float)DZ / (float)DX;    		float Beta = (float)A.Z - ( Slope * (float)A.X );    		float NewX = ( (float)Z - Beta ) / Slope;    		return new Vertex( (int)NewX, Z );	}

The function returns the new point or null if the plane doesn't pass through the line. I tried using doubles, but that was even worse. Points(or vertices) are just 2D points, X and Z.

Edit: The reward is of course, a giant rate++.

I had tons of cracks in my OpenGL stuff but it turns out it was because my view frustum was fucked up.

If a solution doesn't find its way to you, I suggest setting the clear colour to something virtually unnoticable in any DooM game: black. [grin]

Quote:
 Original post by Ravuya I had tons of cracks in my OpenGL stuff but it turns out it was because my view frustum was fucked up.

Unfortunatly Doom coordinates are in pixels, so setting the clipping plane to anything other than some insane value cuts off most of the level and looks wrong. I'll probably have to scale everything down.

Quote:
 Original post by HopeDagger If a solution doesn't find its way to you, I suggest setting the clear colour to something virtually unnoticable in any DooM game: black. [grin]

That would work, except for the bright red or orange sky.

Set the clear colour to the average colour of the skybox.

A lot of older games (back when the best we had going was 3Dfx cards or software rendering, both of which tended to be somewhat inaccurate) just wouldn't clear the colour buffer. As long as you're drawing *something* to all the pixels this works quite nicely, as the cracks pick up the colour that was previously there.

Quote:
 Original post by OrangyTang A lot of older games (back when the best we had going was 3Dfx cards or software rendering, both of which tended to be somewhat inaccurate) just wouldn't clear the colour buffer. As long as you're drawing *something* to all the pixels this works quite nicely, as the cracks pick up the colour that was previously there.

That would work as well, except for outdoor areas. Anyway it's not a problem now since I implemented glBSP.

## Create an account

Register a new account