I was wondering about how much .scn data I should have in my SCNKit application? Are there any limitations except the general iOS app size limitations (found in this post)?
I'd expect that it should be a reasonable size compared to the device RAM. So to be safe for the app not crashing on a specific device it should avoid getting to close to the limits mentioned in this post e.g if the RAM is 1GB I should just stay away from anything around 400MB to be safe?
Further what size of .scn file can I have loaded at one time? So e.g. if there are 6 scenes of 40MB each, it might be not a good idea to have all of them loaded into memory at one time (240MB) but okay to swap them around when needed? But this would still be a big amount of data when having the over-the-air limit in mind.
I lack experience in terms what can I expect from an application using SCNKit scenes and couldn't find very much to hold on.
Seems that it's incorrectly to talk about the Apple's game engines (like SceneKit or RealityKit) in such a context. As you know, game engines render 3D content in real time at 60 fps. If there is a drop frame, the app displays the content intermittently. As soon as you cross the "red line" you'll get notorious drop frame.
What can make you cross this "red line"? It's a good question. Usually, scenes containing more than 100K polygons in total (especially in iOS), heavy-contact physics, emission of a large number of particles, Hi-res 4K textures, realtime shadows and large number of PBR materials can make your app to guaranteedly start skipping frames.
How to deal with it? There is no miraculous remedy. As soon as you notice that your app "stutters", first of all, you need to control a number of polygons (keep it under 100K) and textures' size (keep them under 2K). Physics and particles are more difficult to control, but they also need to be controlled. For example, a single particle emitter will work nicely even if it emits about 20K particles per second (with a moderate lifespan), not millions of them.
This table helps you understand what certain entities affect (macOS version).
SceneKit entity | What does it affect? |
---|---|
Hi-rez textures (4K or 8K) | Consume considerably more RAM |
Higher number of polygons | Increases CPU processing and consumes more RAM |
Higher number of particles | Increases GPU / CPU processing, consumes more RAM |
Higher number of PBR materials | Increases GPU processing and consumes more RAM |
Hi-rez poly-models with forward shadows | Considerably increase GPU processing |