Posts

Post not yet marked as solved
3 Replies
2.1k Views
Hi,I'm trying to understand what SceneKit does to load assets — when it loads them, where it loads them, etc..I cannot find detailed documentation on this but maybe I'm looking in the wrong place. The best I've found so faris the discussion sections in the API docs for SCNSceneRenderer.prepare(_:withCompletionHandler: ) and SCNSceneRenderer.prepare(_:shouldAbortBlock: ).Both of these methods have discussion sections that say the following:By default, SceneKit lazily loads resources onto the GPU for rendering. This approach uses memory and GPU bandwidth efficiently, but can lead to stutters in an otherwise smooth frame rate when you add large amounts of new content to an animated scene. To avoid such issues, use this method to prepare content for drawing before adding it to the scene. You can call this method on a secondary thread to prepare content asynchronously.SceneKit prepares all content associated with the object parameter you provide. If you provide an SCNMaterial object, SceneKit loads any texture images assigned to its material properties. If you provide an SCNGeometry object, SceneKit loads all materials attached to the geometry, as well as its vertex data. If you provide an SCNNode or SCNScene object, SceneKit loads all geometries and materials associated with the node and all its child nodes, or with the entire node hierarchy of the scene. ...You can observe the progress of this operation with the Progress class. For details, see Progress. This raises more questions for me, some of them probably pretty basic (I'm no expert in 3D graphics programming), and some maybe not so dumb:Does "loads resources onto the GPU" mean it is loading the assets into dedicated memroy separate from normal RAM? Or into normal RAM reserved for the GPU? Or into some kind of memory that's actually on the GPU? (This is the dumb question, I bet.)How many assets can be loaded ahead of time in this way?What happens if I try to load more than can fit?If SceneKit uses "a secondary thread to prepare content asynchronously", what happens if I try to access the content before the background loading operation completes? Does my access block or fail?If I can observe the operation with an NSProgress object, then how come these methods do not return NSProgress instances? Or how come the SCNSceneRenderer does not provide an accessor to get return an NSProgress instance?I'd appreciate any insight into these questions, or pointers to WWDC videos, documentation, or third-party books that go into enough detail that they would address these questions.Thanks!
Posted
by algal.
Last updated
.
Post not yet marked as solved
3 Replies
930 Views
Hi,I am seeing a bizarre issue that presents only on the iPhone 8 or iPhone 8 Plus, and I'm hoping someone here can suggest a reason for it. What I am observing on the iPhone 8 and iPhone 8 Plus only, is that when I start my capture session, with the device in portrait or landscapeLeft orientation, then AVFoundation only reports 0 for the yawAngle of any faces it detects.If I start the capture session with the the device in another orientation, or if I tilt the device into another orientation and then back to portrait or landscaleLeft, then the AVFoundation reports face yawAngle as usual.In the app where I'm seeing this problem, I am also gathering AVFoundation sample buffers at the same time but this should not be a problem. In addition, I'm managing two CMMotionManagers, but I'm not using motion values to modify the capture session in anyway, so I don't think it's my logic that's producing this result. Also, none of my logic cares about UIDeviceOrientation as such, since it's observing much smaller angular changes.Since it's the initial state of UIDeviceOrientation that produces this problem, and a change back and forth in UIDeviceOrientation that can fix it, it seems that the problem is produced by some mechanism that is watching UIDeviceOrientation itself, as I suppose AVFoundation must be doing, since it must know about the device's orientation in order to configure its face detector.Alexis
Posted
by algal.
Last updated
.