Artifice, Inc.


Artifice Tech Notes


Note: These are informal notes provided for the general interest of the Internet community. Use them at your own risk.
Tech Notes Contents

Performance Comparisons on some QuickDraw 3D Geometries


Date: Wed, 18 Jun 97 14:15:41 -0700
From: Robert Zako 
Subject: Speed Tests on Mesh, Polyhedron and Trimesh Geometries

INTRODUCTION

At Artifice, Inc., we have also just completed extensive tests on 
rendering speeds using mesh, polyhedron and trimesh geometries. We 
rendered using the wire frame renderer, the interactive renderer with 
Apple hardware acceleration, and the interactive renderer without 
hardware acceleration. We also measured binary 3DMF files sizes and file 
reading/writing times.



METHODOLOGY

We generated test files consisting of 2-dimensional arrays of 1x1x1 
blocks. Each test file contained 1, 100, 1000, 3000 or 10000 blocks that 
were identical except for their positions. By testing files with 
different numbers of blocks, we could distinguish the fixed rendering 
overhead time from the variable per object rendering time.

We generated test files using several different kinds of blocks: solid, 
textured and tunneled. (See the detailed descriptions below and the sample 
3DMF files, available on request.  Please contact support@artifice.com.)

Each solid block had 8 vertices and 6 square faces. For the polyhedron 
and trimesh geometries, each square face was represented by 2 triangles 
created by dividing the square along its diagonal. Thus each polyhedron 
or trimesh geometries had 12 triangles. Using TQ3PolyhedronEdgeMask 
values, the diagonals in the polyhedron blocks were made invisible. The 
trimesh geometry does not support invisible edges.

Each textured block had 14 vertices and 6 square faces. The additional 
vertices were duplicates required to get the surface UV parametrization 
correct. See Figure 4-5 in "3D Graphics Programming With QuickDraw 3D 
1.5" and join the 6 faces together to form a "T". For the polyhedron and 
trimesh geometries, all faces were triangulated as for the solid blocks. 
Each textured block had its own surface UV parametrization vertex 
attributes, but the texture shader was applied globally to the entire 
model.

Each tunneled block was a solid block with a square hole cut from the 
front face through to the back face. As a result, the front and back 
faces were ring-shaped and the tunnel added 4 rectangular faces. Thus 
each tunneled block had 16 vertices, 4 square faces, 4 rectangular faces, 
and 2 ring-shaped faces. For the polyhedron and trimesh geometries, each 
square or rectangular faces was represented by two triangles; each 
ring-shaped face was represented by 8 triangles. Thus each polyhedron or 
trimesh geometry had 32 triangles.

Note that rendering times vary due to caching. We repeated each 
measurement several times and used the MINIMUM rendering time, which 
appeared to be the most stable value.

We ran our tests on a Power Mac 8600/200 with 64M of RAM and an Apple 
graphics accelerator card. All files were opened with a version of 
DesignWorkshop that logs timing data.



RESULTS

All times are in ticks (1 tick = 1/60 second). A smaller time is better.

The rate is the number of objects rendered per second after adjusting for 
the fixed rendering overhead time. The rate was computed using a linear 
regression through the data points. The rate is reported in 1000's of 
objects per second. Thus "4.1" means 4100 objects per second. A larger 
rate is better.

                        WIRE FRAME RENDERER

                              Total Number of Objects     
    Kind      Geometry       1  100  1000  3000  10000    Rate
    --------  ----------    --  ---  ----  ----  -----    ----
    solid     mesh           2    4    17    46    n/a     4.1
      "       polyhedron     2    3     6    12     32    20.3
      "       trimesh        2    3     7    15     41    15.7
    textured  mesh           2    5    26    74    n/a     2.5
      "       polyhedron     2    3     6    12    n/a    18.4
      "       trimesh        2    3     7    16    n/a    13.0
    tunneled  mesh           2    7    48   134    n/a     1.4
      "       polyhedron     2    3     9    21     60    10.4
      "       trimesh        2    4    13    32     95     6.5

Looking at the rates, observe that the polyhedron geometry is somewhat 
faster than the trimesh geometry. This makes sense when you realize that 
the trimesh geometries are rendering diagonal lines whereas the 
polyhedron geometries are not.

It is more difficult to understand why the meshes are so slow: After all, 
the wire frame renderer is merely drawing lines. For any geometry, it is 
only necessary to transform the vertices from local to window coordinates 
and then draw lines between them.

Also observe that the polyhedron geometry is 5-7 times faster than the 
mesh geometry, which does not seem to make sense. After all, the wire 
frame renderer is merely drawing lines. For any geometry, it is only 
necessary to transform the vertices from local to window coordinates and 
then draw lines between them. Why should meshes be so much slower here?

Finally, note that rendering tunneled blocks takes 2-3 times longer, in 
proportion to the added topological complexity. Similarly, adding 
textures slows down the rendering somewhat, which is probably due to the 
added topological complexity since the textures are not actually rendered 
by the wire frame renderer.

        INTERACTIVE RENDERER (WITH APPLE ACCELERATOR CARD)

                              Total Number of Objects     
    Kind      Geometry       1  100  1000  3000  10000    Rate
    --------  ----------    --  ---  ----  ----  -----    ----
    solid     mesh           5    5    26    71    n/a     2.7
      "       polyhedron     4    4    13    32     93     6.8
      "       trimesh        4    4     9    22     63    10.1
    textured  mesh           5    7    41   118    n/a     1.6
      "       polyhedron     4    6    25    67    n/a     2.9
      "       trimesh        4    5    15    31    n/a     6.6
    tunneled  mesh           6   10    67   186    n/a     1.0
      "       polyhedron     6    6    28    75    233     2.6
      "       trimesh        6    6    19    47    138     4.5

Looking at the rates, observe that the trimesh geometry is 1.5-2.5 times 
faster than the polyhedron geometry and 3.5-4.5 times faster than the 
mesh geometry.

As expected, adding textures or tunnels slows down the rendering time, in 
line with the added topological and/or textural complexity.

                  INTERACTIVE RENDERER (SOFTWARE)

                              Total Number of Objects     
    Kind      Geometry       1  100  1000  3000  10000    Rate
    --------  ----------    --  ---  ----  ----  -----    ----
    solid     mesh          15   18    38    83    n/a     2.7
      "       polyhedron    15   16    24    39     93     7.7
      "       trimesh       15   16    21    32     72    10.6
    textured  mesh          15   20    50   125    n/a     1.6
      "       polyhedron    15   18    37    76    n/a     3.0
      "       trimesh       15   17    26    40    n/a     7.3
    tunneled  mesh          15   22    77   188    n/a     1.0
      "       polyhedron    15   16    36    77    216     3.0
      "       trimesh       15   16    27    50    128     5.3

Again, the trimesh geometry is 1.5-2.5 times faster than the polyhedron 
geometry and 3.5-5.5 times faster than the mesh geometry.

Surprisingly, for large models, the interactive renderer is hardly slower 
and in some cases even faster without hardware acceleration than with 
hardware acceleration.

Looking at the column for models with only 1 object, we see that it takes 
15 ticks (1/4 second) to render small models. This seems like an a long 
time considering that the renderer has to do little other than copy bits 
to a buffer and then to the screen: There is so little geometry that the 
computation time should be negligible.



Lastly, we also looked at file sizes and file reading/writing times. The 
file size rate is in bytes/object. The reading/writing rates are in 
1000's of objects per second. The reading/writing rates adjust for any 
fixed overhead time and only reflect the variable time per object.

                 BINARY 3DMF FILE

                            Size    Read    Write   
    Kind      Geometry      Rate    Rate    Rate
    --------  ----------    ----    ----    ----
    solid     mesh           236     0.2     0.4 
      "       polyhedron     308     1.9     0.5
      "       trimesh        192     2.2     0.6
    textured  mesh           792     0.03    0.1
      "       polyhedron     864     0.1     0.2
      "       trimesh        412     1.3     0.5
    tunneled  mesh           452     0.06    0.4
      "       polyhedron     724     0.9     0.4
      "       trimesh        348     1.5     0.5

Note that binary files with trimesh geometries are the smallest; binary 
files with polyhedron geometries are the largest.

Note that solid and tunneled trimesh files read slightly faster than 
corresponding polyhedron files. In contrast, textured trimesh files read 
9 times faster than textured polyhedron files. The large difference is 
probably due to the more efficient handling of attributes by trimeshes.

Even more dramatic, trimesh files read 13 or more times faster than 
corresponding mesh files. The greatest difference is for textured files 
(which contain attributes). Why does it take so excruciatingly long to 
open files with meshes?

Trimesh files also write faster than polyhedron or mesh files, although 
the differences are much less dramatic than for reading.



CONCLUSIONS

By most measures, trimeshes outperform polyhedra which outperform meshes. 
One notably exception: With the wire frame renderer, polyhedra render 
faster than trimeshes (assuming that some internal lines are made 
invisible) and for some applications look much better.



Foyer | DW Pro | DW Lite | Orders | Gallery | Great Buildings | Message Board | Support | Search | Index
© 1997 Artifice, Inc. - All Rights Reserved.  This document is provided for on-line viewing only.

http://www.artifice.com/tech/geometry_performance.html