2 years ago

#28270

test-img

acw

RealityKit custom session config fails to load assets

I'm just using the standard template out of the box with custom configuration for my SwiftUI + RealityKit project:

func makeUIView(context: Context) -> ARView {
        
        let arView = ARView(frame: .zero, cameraMode: .ar, automaticallyConfigureSession: false)

        let config = ARWorldTrackingConfiguration()
        config.sceneReconstruction = .meshWithClassification
        config.isAutoFocusEnabled = true
        if type(of: config).supportsFrameSemantics(.sceneDepth) {
            config.frameSemantics = .personSegmentationWithDepth
        }
        arView.environment.sceneUnderstanding.options.insert([.occlusion, .collision, .physics])
        arView.session.run(config)

        // Load the "Box" scene from the "Experience" Reality File
        let boxAnchor = try! Experience.loadBox()
        
        // Add the box anchor to the scene
        arView.scene.anchors.append(boxAnchor)
        
        return arView
        
    }

And in my AppDelegate.swift:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        guard ARWorldTrackingConfiguration.supportsSceneReconstruction(.meshWithClassification)
                else {
                    fatalError("Scene reconstruction requires a device with a LiDAR Scanner.")
                }

        // Create the SwiftUI view that provides the window contents.
        let contentView = ContentView()

        // Use a UIHostingController as window root view controller.
        let window = UIWindow(frame: UIScreen.main.bounds)
        window.rootViewController = UIHostingController(rootView: contentView)
        self.window = window
        window.makeKeyAndVisible()
        return true
    }

Where the only change in the AppDelegate was the guard. The app loads fine, no crash, but the asset/"Box" does not load. Even if I enable debug mode with the config with meshes being displayed, nothing appears. When I don't run arView.session.run(config), the asset loads perfectly fine. What am I doing wrong to crash this?

Stack Trace:

2022-01-08 20:12:39.259887-0500 ProjectName[8332:1907281] Metal GPU Frame Capture Enabled
2022-01-08 20:12:39.259969-0500 ProjectName[8332:1907281] Metal API Validation Enabled
2022-01-08 20:12:39.773093-0500 ProjectName[8332:1907281] [AssetTypes] Registering library (/System/Library/PrivateFrameworks/CoreRE.framework/default.metallib) that already exists in shader manager. Library will be overwritten.
2022-01-08 20:12:39.911690-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/suFeatheringCreateMergedOcclusionMask.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.929337-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arKitPassthrough.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.929836-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/drPostAndComposition.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.930264-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arSegmentationComposite.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.930796-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute0.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.931443-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute1.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.931666-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute2.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.938318-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute3.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.938548-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute4.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.938769-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute5.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.938988-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute6.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.939206-0500 ProjectName[8332:1907281] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute7.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle
2022-01-08 20:12:39.939603-0500 ProjectName[8332:1907281] [Foundation.Serialization] Json Parse Error line 18: Json Deserialization; unknown member 'EnableARProbes' - skipping.
2022-01-08 20:12:39.939624-0500 ProjectName[8332:1907281] [Foundation.Serialization] Json Parse Error line 20: Json Deserialization; unknown member 'EnableGuidedFilterOcclusion' - skipping.
2022-01-08 20:12:40.087872-0500 ProjectName[8332:1907518] [espresso] Warning: padding deconvolution PersonSeg/decoder/deconv_64/conv2d_transpose:0 in SAME mode will not be pad-invariant for all resolutions
2022-01-08 20:12:40.087905-0500 ProjectName[8332:1907518] [espresso] Warning: padding deconvolution PersonSeg/decoder/deconv_32/conv2d_transpose:0 in SAME mode will not be pad-invariant for all resolutions
2022-01-08 20:12:40.087924-0500 ProjectName[8332:1907518] [espresso] Warning: padding deconvolution PersonSeg/decoder/deconv_16/conv2d_transpose:0 in SAME mode will not be pad-invariant for all resolutions
2022-01-08 20:12:40.087939-0500 ProjectName[8332:1907518] [espresso] Warning: padding deconvolution PersonSeg/decoder/deconv_8/conv2d_transpose:0 in SAME mode will not be pad-invariant for all resolutions
2022-01-08 20:12:40.087953-0500 ProjectName[8332:1907518] [espresso] Warning: padding deconvolution PersonSeg/decoder/deconv_4/conv2d_transpose:0 in SAME mode will not be pad-invariant for all resolutions
2022-01-08 20:12:40.087966-0500 ProjectName[8332:1907518] [espresso] Warning: padding deconvolution PersonSeg/decoder/deconv_2/conv2d_transpose:0 in SAME mode will not be pad-invariant for all resolutions
2022-01-08 20:12:40.110102-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110434-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110471-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110504-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110536-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110625-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110660-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110795-0500 ProjectName[8332:1907281] throwing -10878
2022-01-08 20:12:40.110874-0500 ProjectName[8332:1907281] throwing -10878

ios

swift

swiftui

arkit

realitykit

0 Answers

Your Answer

Accepted video resources