we have a new VisionOS project, our reality composer pro package takes more than 10 minutes to build from a clean build.
We are following all the Apple guidelines to maintain a good performances in app. Unfortunately we couldn't find any guidelines about the project setup and building performances.
What would be the best approach to speed up the building time? Is Modularisation a good option? Did you find any trick to make it faster?
Many factors can affect building time, loading time and performance of your app. However, the main rule is – the larger your app, the longer it will take to compile. The loading and compiling speed of app is undoubtedly influenced by the number of RCP scenes, hi-rez polygonal geometry, Pixar's USDZ variants, PBR shaders, textures, asset animation, physics, spatial sounds, lighting, particles, video, etc. Developers always want to "turn all the knobs to the maximum" in AR app, but they always need to maintain a balance between the visual representation of AR scene and the real capabilities of the hardware and software. Below I want to list a few important points that you need to pay attention to when creating assets for iOS, visionOS and macOS apps in RealityKit 4.0.
Option | Value |
---|---|
The ultimate number of polygons in RealityKit's Scene | iOS 100K / visionOS 200K |
What file format loads models faster? | .reality, (in lesser extent .usdz) |
Acceptable resolution of JPG and PNG textures | 2048 x 2048, (1024 x 1024 better) |
Acceptable number of MaterialX shaders in scene | as little as possible |
Acceptable number of PBR shaders in scene | as little as possible |
Is it good to use transparency in textures? | yes, if very moderately |
What is the best shadow type for RealityKit? | fake and baked shadows |
What's the best codec for RGBA video in AR? | HEVC with Alpha |
How much character animation should a scene contain? | moderate amount |
How much rigid body physics should a scene contain? | moderate amount |
Honestly speaking, without changing any of the above in your app, there is little you can do to speed up a building time (if you build it on Mini or on Air). You will definitely need a Mac Pro to develop multi-level hi-rez games, because the number of build iterations will be uncountable. It makes no sense to compare a top Mac Pro and a weak laptop – compile time on Mac Pro will be significantly faster. Besides, compile time is negatively affected by a small amount of RAM, and you shouldn't compile in Debug Mode. However, in the case of 10-minutes-compile-time on your M1 machine, it's worth starting with textures. Ask yourself a few questions:
alpha
where applicable?power of 2
principle?