Gabriel Uribe

Optimizing RealityKit apps for visionOS πŸ› οΈ

β€’

Recently I've been getting back to visionOS game development with RealityKit, and have needed to optimize performance.

Here are some tips that I've found useful.

Link to this headingCheck your triangles

In my case, I recently realized that one of my assets had a lot of triangles.

Reality Composer Pro

If you open your models in Reality Composer Pro, you can see the triangle count within Statistics under Geometry.

According to Apple, you shouldn't have more than 500,000 triangles in your immersive experience.

So if you have an overly complex model, you should take some action to avoid framerate drops.

One option is to reduce the number of triangles in your asset, which can usually reduce model size without losing much detail.

For example, with Blender, you can decimate your mesh, optimize textures etc to reduce the number of triangles.

Link to this headingReduce your scene complexity

In some cases, you may need to preserve model detail.

In that case, you can try to reduce the number of entities in your scene by reconsidering the design of your app or game.

Eg for a game, consider making each of your entities more powerful or impactful so that you don't need as many units to keep the game challenging.

Link to this headingEnsure you're reusing assets

Make sure that you're only loading asset files (models, animations) once, and duplicating entities as needed via .clone() instead of .load().

This avoids redundant disk IO and helps with performance.

Link to this headingClosing

That's all for now. Check back soon, as I'll be making a follow-up post on how I debug RealityKit apps/games.

Finally, if you got something out of this and/or would like to see additional detail, I'd love to hear from you on X (formerly Twitter) or LinkedIn.

Link to this headingRelated

Link to this headingLooking for more posts?

Looking for a full-stack Next.js/iOS/visionOS developer for your project? Email us at hello@skyporch.co.