Stripping is the process of taking a mesh and turning it into all set of strips as shown below. Without stripping, when a triangle mesh is sent down the graphics display pipeline, three vertices plus three normals or colors must be sent for each triangle. However, in some cases triangles occur in a 'strip', where one triangle points up, the next points down, then the next up, etc. forming parallel lines along the top and bottom.
In this case all that needs to be transmitted along the pipeline is one triangle plus one vertex per additional triangle. Since the communication between the CPU and the graphics card is one of the bottlenecks in the graphics pipeline this results in a significant speed increase.
This can only happen if 3ds Max knows that each new triangle is adjoining the previous one. Stripping then, is the process of taking whatever configuration the mesh is in originally, and turning it into a sequence of sequence of vertices that all correspond to strips as shown above. This speeds up the display process dramatically.
Developers who create their own mesh objects for display need to be aware of two new methods for dealing with stripping if maximum speed is to be achieved. These method are Mesh::BuildStrips()
and Mesh::BuildStripsAndEdges()
. These builds the strip (and edge) databases inside the mesh. The standard 3ds Max primitives call BuildStripsAndEdges()
after creating their meshes for instance.
Changes have been made to the 3ds Max geometry pipeline that make this important. In 3ds Max 1.x, an algorithm was used to build the edge database when the mesh was about to be displayed. So for example, if a mesh was built, and some modifiers acted upon it, for instance a Bend, the geometry pipeline would be evaluated and then the when the object was about to be displayed its edge list would be built. If the modifers were animated (say the Bend angle changed), the geometry pipeline would be evaluated and the edge list would be built again. This was very inefficient because the edge list would only get used for one display, and then would be thrown out, and then calculated again. Since a Bend modifier doesn't alter the mesh topology the edge list was actually still valid.
In 3ds Max 2.0 this changed. The edge and new strip topology flows down the pipeline. In this way, if a primitive builds its own edges and strips by calling BuildStripsAndEdges()
, when animated modifiers are applied the display is dramatically faster. This is because the strip and edge database is never rebuilt unless the topology changes. Therefore when a developer creates a mesh to be displayed they should call BuildStripsAndEdges()
. If this is not done, they won't be available to flow down the pipeline, and must be build automatically at the end of the pipeline.
If a developer knows that their strips are invalid, for example they've deleted a vertex or face, or otherwise changed the topology of the mesh, then the method InvalidateStrips()
and InvalidateEdgeList()
should be called. A developer could also call InvalidateTopologyCache()
which simply calls both of the above.
However, if a modifier is written that changes topology (ChannelsChanged()
includes TOPO_CHANNEL
), for example with the Bomb modifier, then the invalidation happens automatically. Other objects or modifiers may have to make an explicit call to InvalidateTopologyCache()
. For example, the Editable Mesh Object or the Edit Mesh Modifier can operate on a mesh at the push and pull vertex level rather than at the pipeline level. In these cases the mesh is being directly modified and thus the invalidate call is required.