FPS drop when making a 3D object appear (AR app made with SceneKit)

In our AR app and appclip made with SceneKit, we experience very significant drops in framerate when we make our 3D content appear at different steps of the experience.

For now all of our 3D objects are in our Main Scene. Those which are supposed to appear at some point in the experience have their opacity set to 0.01 at the beginning and then fade in with a SCNAction (the reason why we tried setting their opacity to 0.01 at start was to make sure that these objects are rendered from the start of the experience).

However, if the objects all have their opacity set to 1 from the start of the experience, we do not experience any fps drop.

It is worth noting that the fps drops only happen the first time the app is opened. If I close it and re-open it, then it unfolds without any freeze.

What would be the best way to load (or pre-load) these 3D elements to avoid these freezes?

We have conducted our tests on an iPhone X (iOS 15.2.1), on an iPhone 12 Pro (iOS 14), and on an iPad Pro 2020 (iPad OS 14.8.1).

Replies

You can preload the assets.

prepareObject:shouldAbortBlock: https://developer.apple.com/documentation/scenekit/scnscenerenderer/1522798-prepareobject

prepareObjects:withCompletionHandler: https://developer.apple.com/documentation/scenekit/scnscenerenderer/1523375-prepareobjects

Post not yet marked as solved Up vote reply of hr_ Down vote reply of hr_

Hi, thanks for your answer. However, since our SceneView is an ARCNView, we can't seem to access the SCNSceneRenderer methods.

We only have access to the "Prepare" method.

We tried implementing it to preload the scene and it assets.

It seems to be doing something because we get a significantly longer freeze at the start of the experience, however we still experience the same fps drops during the experience when our objects appear for the first time.