| 1 |
DESCRIPTION OF PROBLEM: |
| 2 |
======================= |
| 3 |
|
| 4 |
The example map, maps/disappearing_sliver2.map, contains an example of this |
| 5 |
bug. The triangle sliver surface in the middle of the room is not rendered |
| 6 |
in the final BSP. |
| 7 |
|
| 8 |
To trigger the bug, compile the map; you don't need -vis or -light. Only |
| 9 |
-bsp (the first q3map2 stage) is necessary to trigger the bug. The only |
| 10 |
entities in the map are a light and a info_player_deathmatch, so the map will |
| 11 |
compile for any Q3 mod. |
| 12 |
|
| 13 |
|
| 14 |
SOLUTION TO PROBLEM: |
| 15 |
==================== |
| 16 |
|
| 17 |
It was discovered that BaseWindingForPlane() in polylib.c did some sloppy |
| 18 |
mathematics with significant loss of precision. Those problems have been |
| 19 |
addressed in commits to revisions 371 and 377. |
| 20 |
|
| 21 |
|
| 22 |
POSSIBLE SIDE EFFECTS: |
| 23 |
====================== |
| 24 |
|
| 25 |
Great care was taken to preserve the exact behavior of the original |
| 26 |
BaseWindingForPlane() function except for the loss of precision. Therefore |
| 27 |
no negative side effects should be seen. In fact performance may be |
| 28 |
increased. |
| 29 |
|
| 30 |
|
| 31 |
IN-DEPTH DISCUSSION: |
| 32 |
==================== |
| 33 |
|
| 34 |
Turns out that the problem is very similar to the original disappearing_sliver |
| 35 |
regression test. You should read that README.txt to familiarize yourself |
| 36 |
with the situation. |
| 37 |
|
| 38 |
The thing we need to look at is side 0 of brush 0, if you applied |
| 39 |
winding_logging.patch from disappearing_sliver regression test: |
| 40 |
|
| 41 |
In ParseRawBrush() for brush 0 |
| 42 |
Side 0: |
| 43 |
(6784.000000 16241.000000 -1722.000000) |
| 44 |
(6144.000000 16083.000000 -1443.000000) |
| 45 |
(6144.000000 16122.000000 -1424.000000) |
| 46 |
|
| 47 |
That is the exact plane defninition of our problem sliver, and in fact those |
| 48 |
are also the correct points for the actual vertices of the triangle. |
| 49 |
|
| 50 |
Now the results of the winding for this surface after all the clipping takes |
| 51 |
place: |
| 52 |
|
| 53 |
(6784.12500000 16241.02343750 -1722.06250000) |
| 54 |
(6144.00000000 16082.99218750 -1443.00781250) |
| 55 |
(6144.00000000 16122.00000000 -1424.00390625) |
| 56 |
|
| 57 |
As you can see, 6784.12500000 is more than epsilon distance (0.1) away from |
| 58 |
the correct point. This is a big problem. |
| 59 |
|
| 60 |
After we apply the fix committed in revision 371, the result after clipping |
| 61 |
is this: |
| 62 |
|
| 63 |
(6784.06250000 16241.01171875 -1722.03515625) |
| 64 |
(6144.00000000 16082.99609375 -1443.00781250) |
| 65 |
(6144.00000000 16122.00000000 -1424.00585938) |
| 66 |
|
| 67 |
As you can see, all points but one have an increase in accuracy. This is |
| 68 |
still not accurate enough in my opinion, but is a step in the right direction. |
| 69 |
|
| 70 |
After the fix committed in revision 377, which is a further attempt to address |
| 71 |
BaseWindingForPlane(), we get the following accuracy: |
| 72 |
|
| 73 |
(6784.00000000 16241.00000000 -1722.00000000) |
| 74 |
(6144.00000000 16083.00000000 -1443.00000000) |
| 75 |
(6144.00000000 16122.00000000 -1424.00000000) |
| 76 |
|
| 77 |
It's just a fluke for this particular case, but obviouly revision 377 looks |
| 78 |
favorably upon this regression test, because there is zero percent error. |
| 79 |
|
| 80 |
|
| 81 |
MORE NOTES: |
| 82 |
=========== |
| 83 |
|
| 84 |
I attempted to improve upon revision 371 by streamlining the code in |
| 85 |
BaseWindingForPlane() some more. Those attempts were committed as revision |
| 86 |
375. After revision 375: |
| 87 |
|
| 88 |
(6784.09375000 16241.01757812 -1722.04687500) |
| 89 |
(6144.00000000 16082.99414062 -1443.00390625) |
| 90 |
(6144.00000000 16122.00000000 -1424.00097656) |
| 91 |
|
| 92 |
Revision 375 has since been reverted (undone) because of the loss in |
| 93 |
accuracy. Revision 377 is a fix for those failed attempts. |