Performance Tuning


General Consideration

There are several factors that affect the overall performance of a 3D application. The most significant issues are the system resources and the data sizes. Choices of materials will also affect the overall performance.

Hardware

The most important thing you can do to improve performance it to run the software on a system that has hardware accelerated OpenGL. View3D will run on any X/Motif system with OpenGL. On non hardware accelerated systems, we can supply Mesa OpenGL (a free OpenGL library that runs under X). If your system has a 3D accelerator (SGI, Sun ZX, etc.) we highly recommend that you use it by acquiring a hardware accelerated OpenGL for your system.

Memory

The amount of data that you are visualizing is also a key factor in the overall performance. If you are running on a system with 64 megs of memory and manipulating a series of surfaces that take up 96 megs of memory, the system will be performing an enormous amount of swapping. The following table will give you an idea of how much memory each object type takes. This assumes single precision data. If you are using double precision data, double the figures.

ObjectMemory Required (bytes)
XintOBJECT_LINE582+ (num_vertices * 12) + (num_indices * 4)
XintOBJECT_MESH_SURFACEnv=num verts, nl=num index lists,
ni=num of indices/list, np=num polys,
nvp=num verts/poly.


XintOBJECT_MARKER450 + strlen(label)
XintOBJECT_POINT502 + (num_vertices * 12)
XintOBJECT_RASTER522 + (num_pixels * 16)
XintOBJECT_GROUP290 + (num_objects_in_group * 4)

These figures are rough estimates of the memory requirements. For example: a 1000x1000 Uniform grid will use approximately 72 megs or memory. You can reduce memory used by this surface to a little as 16 megs by disabling normals and polygon data (XintView3DSetGlobalFlags(), using XintGLOBAL_DISABLE_NORMALS and XintGLOBAL_DISABLE_POLYGON_DATA). If these figures seem extreme, remember that the minimum memory required for a 3D 1000x1000 grid is 12 megs just for the data points.

Different material types will require more memory than others. XintMATERIAL_SINGLE_COLOR only uses a single color value for an object. XintMATERIAL_COLOR_SCALE and XintMATERIAL_MULTI_COLOR require a different color for each vertex. In the example above, using a multi color surface would add approximately 16 megs of data. Using a single color material would only add about 131 bytes (the minimum required for a material).

If you are using multiple View3D widgets to view the same object, the object's data will not be duplicated. If you assign different materials to the object in the different views, the different materials will require their own memory.


Display Resolution

The standard resolution on workstations ranges from 1024x768 to 1280x1024 pixels. If you are viewing an entire 1000x1000 surface, each polygon on the screen will be about 1 pixel wide. You will not notice any polygonal data until you zoom in very closely. If you subsample the surface and reduce the number of polygons to even 300x300, you will not notice a difference in the resolution until you zoom in closely. Unless your work requires close examination of the data, try a greater sample interval.

If you have enough memory to store the surface at different sample intervals, do so. Use the Zoom callback (Release 1.1) to determine when to remove a lower resolution surface and replace it with a higher resolution version.

In general, you do not need to use objects that contain more points (width or height) than the resolution of the window that you are using. If you are displaying 500x500 grids in a 500x500 window, you are wasting resources, try using a 200x200 grid instead (or even a 100x100 grid).


Material Properties

There are several material properties that will adversely affect system performance. The following table lists (in order of severity) the effect on performance of different material types:

Material PropertyEffect
lightingRequires a normal to be specified with each vertex during rendering. This pushes twice as much data along the graphics pipeline. Calculating the effect of light on an object is also costly.
multiple colorsUsing more than a single color to describe an object causes a color value to be specified with each vertex. This double the amount of information needed in the rendering loops. If only a single color is needed, use it.
transparencyForces the rendering to blend colors displayed on the screen.
two sided surfacesForces the rendering routines to render the front and back sides of a surface differently. A two step process.
grid linesMore data that needs to be drawn.
highlightingMore data that needs to be drawn.