iosaugmented-realitymetalrealitykit

Rendering large number of objects in realtime using RealityKit or Metal


I am currently working on a project where I need to render a large number of objects in 3D. However, I have encountered performance issues when attempting to render a significant number of objects.

enter image description here

To provide some context, I have tried looping through my simd3 array, creating sphere meshes, and adding model entities one by one. Unfortunately, this approach is quite slow a. For instance, it takes several seconds to render just 50 objects.

I am seeking solutions or guidance on how to optimize the rendering process to achieve significantly faster results. Ideally, I would like to render around 10,000 objects in approximately 1/90th of a second. Furthermore, I am curious to know if it is possible to render even larger quantities, such as 100,000 or even 1 million objects, in realtime.

Are there any recommended techniques, approaches, or alternative frameworks that can help me?


Solution

  • For optimal performance you will want to use instancing.

    Here is a tutorial on the subject.

    It is also worth mentioning that running in a simulator will not offer the same performance as on actual hardware.