GL2PS Results
S. No | 2D BSP Culling | Actual Prim added in 2D BSP Tree | Checks for Coincident Prim | Lines first for 2D Culling | Total Primitives | Dropped Primitives | Added Primitives | Nodes in 2D BSP Culling Tree | File Size (KByte) |
% Reduction |
1 | NO | N/A | N/A | N/A | 681375 | N/A | N/A | N/A | 34659 | N/A |
2 | YES | NO | NO | NO | 681375 | 675748 | 5627 | 64025 | 311 | 99.1% |
3 | YES | YES | NO | NO | 681375 | 678390 | 2985 | 28068 | 161/td> | 99.5% |
4 | YES | NO | YES | NO | 681375 | 643385 | 37990 | 64048 | 2086 | 93.4% |
5 | YES | YES | YES | NO | 681375 | 677673 | 3702 | 28068 | 201 | 99.4% |
6 | YES | YES | NO | YES | 681375 | 677071 | 4304 | 35943 | 228 | 99.3% |
7 | YES | NO | YES | YES | 681375 | 610384 | 70991 | 67662 | 3894 | 88.7% |
8 | YES | YES | YES | YES | 681375 | 675084 | 6291 | 35946 | 336 | 99.0% |
When we add the actual primitive(DEF) instead of splited one(DEHJ or BHFI) in the 2D BSP tree then the number of nodes in the 2D BSP tree reduces which means less usage of memory and less time to decide a primitive should be culled or not.
As in the coplanar primitives list, triangles come first that's why when we go from front to back ( for 2D culling ) we need to check lines first. In the old implementation we checked the triangles first that's why most of the coplanar lines were culled during 2D culling operation. The increase in number of "Added Primitives" shows that there were some primitives dropped when we processed triangles first for culling. Iteration in reverse order for coplanar primitives when moving from front to back gives much better results.
In the old implementation when a primitive is coincident with the plane represented by a node of the 2D BSP tree then we culled this primitive if it has more then 2 vertex otherwise we keep it (assuming that this line is representing a vertex of a polygon). This was a bug because this way we might drop some primitives which were visible and also we might add some primitives which were although coincident to one node but they might be invisible due to other primitives. In fig B triangle JKL was dropped in the old implementaion because it was coincident to the plane represented by the node AC but this triangle is visible. Similerly the line MN was added in the old implementation because it is coincident to plane represented by nodes AB and PR and point O was also added as it was coincident to both planes represented BC and QB. As now instead of spilted primitive we add the whole actual primitive so line MN and point O will be culled by the triangle DEF