VMF2OBJ icon indicating copy to clipboard operation
VMF2OBJ copied to clipboard

Sort faces by texture

Open Dylancyclone opened this issue 5 years ago • 0 comments

If a brush used multiple materials, it is possible for the .obj file to switch back and forth between the materials multiple times. For optimization, it would be nice to sort the faces so that only one usemtl needs to be used per material per object.

For example:

usemtl tools/toolsnodraw
f 1/1 2/2 3/3 4/4 
usemtl tools/toolstrigger
f 5/5 6/6 7/7 8/8 
usemtl tools/toolsnodraw
f 9/9 10/10 11/11 12/12

could be optimized to:

usemtl tools/toolsnodraw
f 1/1 2/2 3/3 4/4 
f 9/9 10/10 11/11 12/12
usemtl tools/toolstrigger
f 5/5 6/6 7/7 8/8 

Dylancyclone avatar Jun 27 '20 08:06 Dylancyclone