Fri, 02/27/2026 - 06:49
Forums:
Rendering 10,000+ identical objects generates a massive number of draw calls. While using AIS_ConnectedInteractive avoids re-submitting rendering data, it does not reduce the number of draw calls.
Is there a way to achieve an effect similar to native OpenGL's glDrawArraysInstanced? Specifically, can we submit an array of transformation matrices (or other render parameters) to render a large number of objects with a minimal number of draw calls?
Fri, 02/27/2026 - 13:53
Your understanding of Connected Interactive objects is correct. This mechanism allows drawing AIS objects within different locations as a whole, with the same presentation aspects and selection entries, just in different places. But the AIS object itself is quite a heavyweight object on its own, making this mechanism useful for limited scenarios for large objects.
Before going into more efficient instancing mechanisms provided by lower-level graphic libraries like OpenGL, evaluate your scenarios in more detail to check what kind of optimization is worth investment.
The first optimization level would be to group small objects into larger AIS objects. The objects are not required to have the same geometry - different geometry could be simply merged into one Graphic3d_ArrayOfPrimitives (mapped into VBO in OpenGL). This would reduce the number of Draw Calls, improve framerate and reduce memory footprint by avoiding creation of many heavyweight AIS objects. The geometry data will be duplicated in GPU memory, though, but this might not be a real problem for nowadays GPUs.
The next step would be utilizing OpenGL instancing. This approach is more involving, as there are no high-level API for this in AIS, and you'll need to figure out what exactly should be instanced and what should be customized. You will have to define a custom GLSL program, define custom VBO or TBO with instancing information (transformation matrices, colors, etc.) and custom OpenGL drawing commands to perform actual rendering. Normally this is done by subclassing OpenGL_Element.
Fri, 02/27/2026 - 13:54
Based on UserDraw sample, the custom drawer might look like this: