more regression test updates by Rambetter

This commit is contained in:
Rudolf Polzer 2010-12-28 13:38:32 +01:00
parent ec64df5697
commit 1ba2ff7e29
5 changed files with 225 additions and 5 deletions

View File

@ -103,9 +103,7 @@ ChopWindingInPlace() calls in the above stack trace:
(87.989571 -891.969116 -768.174316)
(133.998917 -1014.997314 0.000000)
(If you want to print this out for yourself, print out the coordinates of the
winding_t "w" parameter right after the ChopWindingInPlace() call in
CreateBrushWindings() in brush.c.)
(If you want to print this out for yourself, use winding_logging.patch.)
The same vertices after the bugfix have the following coordinates:

View File

@ -0,0 +1,87 @@
Index: tools/quake3/q3map2/brush.c
===================================================================
--- tools/quake3/q3map2/brush.c (revision 371)
+++ tools/quake3/q3map2/brush.c (working copy)
@@ -356,17 +356,29 @@
winding_t *w;
side_t *side;
plane_t *plane;
+
+ static int brushord = -1;
+ brushord++;
+
+ Sys_Printf("In CreateBrushWindings() for brush %i\n", brushord);
-
/* walk the list of brush sides */
for( i = 0; i < brush->numsides; i++ )
{
+ Sys_Printf(" Handling side %i on the brush\n", i);
+
/* get side and plane */
side = &brush->sides[ i ];
plane = &mapplanes[ side->planenum ];
/* make huge winding */
w = BaseWindingForPlane( plane->normal, plane->dist );
+
+ Sys_Printf(" Before clipping we have:\n");
+ int z;
+ for (z = 0; z < w->numpoints; z++) {
+ Sys_Printf(" (%.8f %.8f %.8f)\n", w->p[z][0], w->p[z][1], w->p[z][2]);
+ }
/* walk the list of brush sides */
for( j = 0; j < brush->numsides && w != NULL; j++ )
@@ -379,6 +391,11 @@
continue;
plane = &mapplanes[ brush->sides[ j ].planenum ^ 1 ];
ChopWindingInPlace( &w, plane->normal, plane->dist, 0 ); // CLIP_EPSILON );
+
+ Sys_Printf(" After clipping w/ side %i we have:\n", j);
+ for (z = 0; z < w->numpoints; z++) {
+ Sys_Printf(" (%.8f %.8f %.8f)\n", w->p[z][0], w->p[z][1], w->p[z][2]);
+ }
/* ydnar: fix broken windings that would generate trifans */
FixWinding( w );
Index: tools/quake3/q3map2/map.c
===================================================================
--- tools/quake3/q3map2/map.c (revision 371)
+++ tools/quake3/q3map2/map.c (working copy)
@@ -803,7 +803,11 @@
char shader[ MAX_QPATH ];
int flags;
+ static int brushord = -1;
+ brushord++;
+ Sys_Printf("In ParseRawBrush() for brush %i\n", brushord);
+
/* initial setup */
buildBrush->numsides = 0;
buildBrush->detail = qfalse;
@@ -812,9 +816,12 @@
if( g_bBrushPrimit == BPRIMIT_NEWBRUSHES )
MatchToken( "{" );
+ int sideord = -1;
+
/* parse sides */
while( 1 )
{
+ sideord++;
if( !GetToken( qtrue ) )
break;
if( !strcmp( token, "}" ) )
@@ -917,6 +924,10 @@
}
/* find the plane number */
+ Sys_Printf(" Side %i:\n", sideord);
+ Sys_Printf(" (%f %f %f)\n", planePoints[0][0], planePoints[0][1], planePoints[0][2]);
+ Sys_Printf(" (%f %f %f)\n", planePoints[1][0], planePoints[1][1], planePoints[1][2]);
+ Sys_Printf(" (%f %f %f)\n", planePoints[2][0], planePoints[2][1], planePoints[2][2]);
planenum = MapPlaneFromPoints( planePoints );
side->planenum = planenum;

View File

@ -14,5 +14,55 @@ compile for any Q3 mod.
SOLUTION TO PROBLEM:
====================
None yet. The problem is likely caused by sloppy math operations (significant
loss of precision).
It was discovered that BaseWindingForPlane() in polylib.c did some sloppy
mathematics with significant loss of precision. Those problems have been
addressed in commit revision 371.
POSSIBLE SIDE EFFECTS:
======================
Great care was taken to preserve the exact behavior of the original
BaseWindingForPlane() function except for the loss of precision. Therefore
no negative side effects should be seen. In fact performance may be
increased.
IN-DEPTH DISCUSSION:
====================
Turns out that the problem is very similar to the original disappearing_sliver
regression test. You should read that README.txt to familiarize yourself
with the situation.
The thing we need to look at is side 0 of brush 0, if you applied
winding_logging.patch from disappearing_sliver regression test:
In ParseRawBrush() for brush 0
Side 0:
(6784.000000 16241.000000 -1722.000000)
(6144.000000 16083.000000 -1443.000000)
(6144.000000 16122.000000 -1424.000000)
That is the exact plane defninition of our problem sliver, and in fact those
are also the correct points for the actual vertices of the triangle.
Now the results of the winding for this surface after all the clipping takes
place:
(6784.12500000 16241.02343750 -1722.06250000)
(6144.00000000 16082.99218750 -1443.00781250)
(6144.00000000 16122.00000000 -1424.00390625)
As you can see, 6784.12500000 is more than epsilon distance (0.1) away from
the correct point. This is a big problem.
After we apply the fix committed in revision 371, the result after clipping
is this:
(6784.06250000 16241.01171875 -1722.03515625)
(6144.00000000 16082.99609375 -1443.00781250)
(6144.00000000 16122.00000000 -1424.00585938)
As you can see, all points but one have an increase in accuracy. This is
still not accurate enough in my opinion, but is a step in the right direction.

View File

@ -0,0 +1,17 @@
DESCRIPTION OF PROBLEM:
=======================
The example map, maps/disappearing_sliver3.map, contains an example of this
bug. The triangle sliver surface in the middle of the room is not rendered
in the final BSP.
To trigger the bug, compile the map; you don't need -vis or -light. Only
-bsp (the first q3map2 stage) is necessary to trigger the bug. The only
entities in the map are a light and a info_player_deathmatch, so the map will
compile for any Q3 mod.
SOLUTION TO PROBLEM:
====================
None yet. Probably due to sloppy math code.

View File

@ -0,0 +1,68 @@
{
"classname" "worldspawn"
{
( 6144 16122 -2048 ) ( 6144 16083 -2048 ) ( 6784 16241 -2048 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 134217728 0 0
( 6144 16122 -1424 ) ( 6144 16122 -2048 ) ( 6784 16241 -1722 ) common/caulk 0 0 0 0.500000 0.500000 134217728 4 0
( 6144 16083 -1443 ) ( 6144 16083 -2048 ) ( 6144 16122 -1424 ) common/caulk 0 0 0 0.500000 0.500000 134217728 4 0
( 6784 16241 -1722 ) ( 6784 16241 -2048 ) ( 6144 16083 -1443 ) common/caulk 0 0 0 0.500000 0.500000 134217728 4 0
( 6784 16241 -1722 ) ( 6144 16083 -1443 ) ( 6144 16122 -1424 ) common/caulk 0 0 0 0.500000 0.500000 134217728 4 0
}
{
( 6160 16432 -2240 ) ( 6048 16432 -2240 ) ( 6048 15936 -2240 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6128 15936 -1376 ) ( 6128 16432 -1376 ) ( 6240 16432 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6032 15936 160 ) ( 6144 15936 160 ) ( 6144 15936 -3552 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 15936 -512 ) ( 6144 16432 -512 ) ( 6144 16432 -4224 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( 6112 16896 160 ) ( 6000 16896 160 ) ( 6000 16896 -3552 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6136 16424 168 ) ( 6136 15928 168 ) ( 6136 15928 -3544 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
{
( 6144 16672 -2240 ) ( 6136 16672 -2240 ) ( 6136 16176 -2240 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6136 16192 -1376 ) ( 6136 16688 -1376 ) ( 6144 16688 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6136 15936 -1280 ) ( 6144 15936 -1280 ) ( 6144 15936 -1760 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6792 16160 -1296 ) ( 6792 16656 -1296 ) ( 6792 16656 -1776 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 16896 -1312 ) ( 6136 16896 -1312 ) ( 6136 16896 -1792 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 16672 -1968 ) ( 6784 16176 -1968 ) ( 6784 16176 -2448 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
}
{
( 6784 15936 -2240 ) ( 6144 15936 -2240 ) ( 6144 15880 -2240 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 15880 -1376 ) ( 6144 15936 -1376 ) ( 6784 15936 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 15928 -896 ) ( 6784 15928 -896 ) ( 6784 15928 -2048 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 15880 -1568 ) ( 6784 15936 -1568 ) ( 6784 15936 -2720 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 15936 -896 ) ( 6144 15936 -896 ) ( 6144 15936 -2048 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( 6144 15936 -1568 ) ( 6144 15880 -1568 ) ( 6144 15880 -2720 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
{
( 6784 16960 -2240 ) ( 6144 16960 -2240 ) ( 6144 16896 -2240 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 16896 -1376 ) ( 6144 16960 -1376 ) ( 6784 16960 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 16896 -896 ) ( 6784 16896 -896 ) ( 6784 16896 -2048 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( 6784 16896 -1568 ) ( 6784 16960 -1568 ) ( 6784 16960 -2720 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 16904 -896 ) ( 6144 16904 -896 ) ( 6144 16904 -2048 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 16960 -1568 ) ( 6144 16896 -1568 ) ( 6144 16896 -2720 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
{
( 6784 16896 -1376 ) ( 6144 16896 -1376 ) ( 6144 16536 -1376 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( 6144 16552 -1368 ) ( 6144 16912 -1368 ) ( 6784 16912 -1368 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 15936 -1224 ) ( 6784 15936 -1224 ) ( 6784 15936 -1336 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 16536 -1264 ) ( 6784 16896 -1264 ) ( 6784 16896 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 16896 -1264 ) ( 6144 16896 -1264 ) ( 6144 16896 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 16896 -1264 ) ( 6144 16536 -1264 ) ( 6144 16536 -1376 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
{
( 6784 16584 -2248 ) ( 6144 16584 -2248 ) ( 6144 15976 -2248 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 15936 -2240 ) ( 6144 16544 -2240 ) ( 6784 16544 -2240 ) radiant_regression_tests/tile 0 0 0 0.500000 0.500000 0 0 0
( 6144 15936 -2240 ) ( 6784 15936 -2240 ) ( 6784 15936 -2568 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 15936 -2240 ) ( 6784 16544 -2240 ) ( 6784 16544 -2568 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6784 16896 -2240 ) ( 6144 16896 -2240 ) ( 6144 16896 -2568 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
( 6144 16544 -2240 ) ( 6144 15936 -2240 ) ( 6144 15936 -2568 ) common/caulk 0 0 0 0.500000 0.500000 0 4 0
}
}
{
"angle" "180"
"origin" "6432 16168 -2144"
"classname" "info_player_deathmatch"
}
{
"light" "1000"
"origin" "6504 16160 -2152"
"classname" "light"
}