XPlane2Blender
XPlane2Blender copied to clipboard
Vertex and Index Order Should be GPU Optimized
The write-out order of the index table and vertex table should be optimized for GPU consumption.
- The index table should run in approximately the linear draw order of the TRIS commands of the file. So this is good:
TRIS 0 12 ATTR_foo TRIS 12 24
This is not so good TRIS 108 9 ATTR_foo TRIS 36 3
Ideally the ordering of primitives going into the index table should be the order of primitives after state sorting.
- The vertex table should run in approximately linear draw order fro the index table, so this is good:
IDX10 0 1 2 1 3 2 2 3 4 3 5 and this is bad IDX10 108 3 16 41 35 21
One naive way to deal with this is to simply accumulate the vertices from the primitives as they are written into the index table with dupe removal; thus the first primitive will get to have as its first index vertex 0, 1 and 2.
We now have very very fast de-duplication code, but it isn't on by default and I believe exhibits this behavior.