Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    177
  • comments
    531
  • views
    164190

Crap

Sign in to follow this  
Scet

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++.
Sign in to follow this  


6 Comments


Recommended Comments

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

Share this comment


Link to comment
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]

Share this comment


Link to comment
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.

Share this comment


Link to comment
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.

Share this comment


Link to comment
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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!