24.09.2021 • C3D Vision

Update to C3D Vision Renderer Improves Performance by 60%

The 2021 release of our C3D Vision visualization engine takes a large step towards improving rendering performance. In this post, we talk about how the speed increase was attained, the new functions in C3D Vision, and how to incorporate them into your applications.

Visualizations of large models can be disappointing when they run slowly, no matter how sophisticated the look of the rendering materials, or how broad the range of tools available for working with scenes. So, the C3D Vision development team took on the task of seeing how they could improve scene performance, while preserving your ability to edit objects in scenes.

The New Representations

The solution our team came up with was a set of completely new geometric representations, which are especially helpful when working with large assemblies.

PolygonRepresentation groups a large number of curves within a single geometry; see figure 1.

Lots of bodies in model

MathGroupRepresentation groups a large number of solids into a single geometry; see figure 2.

Lots of bodies in PolygonRepresentation

Here is how the new representations operate:

  1. When initializing an instance of these classes, the instance creates a container, which users fill with the objects of the loaded model, via an API function.
  2. All objects inside the single geometry are sent for rendering, as a group. The grouping allows all objects to be rendered with a single call to an OpenGL function.

Grouping and making single calls significantly improves performance. The two videos below show the difference in performance between a regular model and the model rendered by grouping. The rotation is smoother and faster in the second video, as it increases in speed by about 60%.

Left: non-grouped model, right: grouped model

New Functions for Representation

Despite grouping model objects, each object in the group can be changed easily via API functions. The following aspects can be changed:

  • Setting a new material to an object
  • Changing an object’s visual properties
  • Changing the matrix of an object to manipulate its position in the scene
  • Adding new objects; removing old ones

Objects in the representation container are accessed through a unique key, an object identifier. Here are the code fragments for initializing instances of the existing MathRepresentation class and the new MathGroupRepresentation class, respectively. Changes are shown in boldface.

// First example. We create regular geometry for visualization
// create math representation
MbItem* pItem = createSqrtSinSurface();
// create visual representation
MathRepresentation* pMathRep = new MathRepresentation();
// we set math representation to visual one
pMathRep->SetMathItem(pItem, 0.2);
// we create a segment with parent set
SceneSegment* seg = new SceneSegment(pMathRep, sceneContent()->GetRootSegment());
// Second example. We create grouped geometry for visualization
// create math representation 
MbItem* pItem = createSqrtSinSurface();
// create visual representation
MathGroupRepresentation* pMathGroupRep = new MathGroupRepresentation();
MbMatrix3D mx; // MbItem matrix
// we set math representation to visual one
pMathGroupRep->AddItem(pItem, mx);
// we create a segment with parent set
SceneSegment* seg = new SceneSegment(pMathGroupRep, sceneContent()->GetRootSegment());

As you can see in the fragment, we added a single line of code (MbMatrix3D) to define the object displacement matrix. The rest of the code takes advantage of our new grouping functions.

We will keep on actively developing C3D Vision, implementing new methods and classes to improve the convenience of using it and to speed up the engine. All this becomes possible not only due to our analyses of the possibilities already available in computer systems, but also due to active users, just like you, who are striving to improve the quality of the visualization module.