Building time, loading time and performance of AR/VR assets
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:
- how many models in your project use USDZ variants?
- how many textures are there in the project?
- what is their resolution?
- does each texture have 72 ppi ?
- is it better to use bake textures for Unlit shader in a scene?
- what's a color depth in your textures – 8-bit vs 16-bit?
- do textures use a compression?
- do they use the same color space and profile?
- do you use procedural textures?
- are there mostly square textures?
- are you using 3-channel or 4-channel textures?
- is it possible to avoid using the
alpha
where applicable?
- what file format do textures use?
- is it possible to combine several textures into one?
- does textures' resolution use the
power of 2
principle?