Estoy trabajando en el proyecto de la aplicación RealityKit y tengo una pregunta. cuando se ve un modelo 3d, tarda más de un minuto en aparecer, la aplicación carga los modelos de Firebase rápidamente, pero tarda en mostrarse en la pantalla y estoy usando la generación iPad 7 para ejecutar la aplicación. Probé el formato obj y usdz y no hay diferencia
este es el codigo que uso
func View3DObject( Name : String){ //start of bring models from firebase @ObservedObject var model = Model(name: Name, category: .animals) //set object on floor let anchorEntity = AnchorEntity(plane: .any, classification: .floor) //get object from database let resultModel = model.asyncLoadModelEntity(){ result in //enable intraction and movment result.generateCollisionShapes(recursive: true) self.arView.installGestures([.translation, .rotation, .scale],for: result) anchorEntity.addChild(result) } //add object to secne self.arView.scene.anchors.append(anchorEntity) print("Model is added to the scene" ) } }función asyncLoadModelEntity:
func asyncLoadModelEntity(completion: @escaping (_ result: ModelEntity) -> Void) -> ModelEntity{ var result = ModelEntity() FirebaseStorageHelper.asyncDownloadFilesystem(relativePath: "models/\(self.name).obj") { localUrl in self.cancellable = ModelEntity.loadModelAsync(contentsOf: localUrl) .sink(receiveCompletion: { loadCompletion in switch loadCompletion{ case .failure(let error): print("Unable to load modelEntity for \(self.name). Error: \(error.localizedDescription)") case .finished: break } }, receiveValue:{ modelEntity in result = modelEntity self.modelEntity = modelEntity // self.modelEntity?.scale *= self.scaleCompensation print("modelEntity for \(self.name) has been loaded") completion(result) }) } return result }Y esta es la consola.
022-03-06 01:43:27.800057+0300 MarsamApp[689:48039] Metal GPU Frame Capture Enabled 2022-03-06 01:43:27.801598+0300 MarsamApp[689:48039] Metal API Validation Enabled 2022-03-06 01:43:28.325928+0300 MarsamApp[689:48039] [AssetTypes] Registering library (/System/Library/PrivateFrameworks/CoreRE.framework/default.metallib) that already exists in shader manager. Library will be overwritten. 2022-03-06 01:43:28.413704+0300 MarsamApp[689:48242] 6.34.0 - [Firebase/Core][I-COR000008] The project's Bundle ID is inconsistent with either the Bundle ID in 'GoogleService-Info.plist', or the Bundle ID in the options if you are using a customized options. To ensure that everything can be configured correctly, you may need to make the Bundle IDs consistent. To continue with this plist file, you may change your app's bundle identifier to 'com.MarsamApp'. Or you can download a new configuration file that matches your bundle identifier from https://console.firebase.google.com/ and replace the current one. 2022-03-06 01:43:28.455746+0300 MarsamApp[689:48246] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1f345e358) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{( "'NSDate' (0x1f34536c0) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSDictionary' (0x1f3453828) [/System/Library/Frameworks/CoreFoundation.framework]" )}'. This will be disallowed in the future. 2022-03-06 01:43:28.477648+0300 MarsamApp[689:48246] 6.34.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60900000 started 2022-03-06 01:43:28.478318+0300 MarsamApp[689:48246] 6.34.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see) 2022-03-06 01:43:28.491851+0300 MarsamApp[689:48246] 6.34.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement 2022-03-06 01:43:28.498980+0300 MarsamApp[689:48242] 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled 2022-03-06 01:43:28.499730+0300 MarsamApp[689:48242] 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist 2022-03-06 01:43:28.634100+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/suFeatheringCreateMergedOcclusionMask.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.718313+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arKitPassthrough.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.720479+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/drPostAndComposition.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.722138+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arSegmentationComposite.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.724000+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute0.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.726142+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute1.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.727083+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute2.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.741687+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute3.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.742755+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute4.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.743783+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute5.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.744806+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute6.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.745873+0300 MarsamApp[689:48039] [Assets] Resolving material name 'engine:BuiltinRenderGraphResources/AR/arInPlacePostProcessCombinedPermute7.rematerial' as an asset path -- this usage is deprecated; instead provide a valid bundle 2022-03-06 01:43:28.747365+0300 MarsamApp[689:48039] [Foundation.Serialization] Json Parse Error line 18: Json Deserialization; unknown member 'EnableARProbes' - skipping. 2022-03-06 01:43:28.747443+0300 MarsamApp[689:48039] [Foundation.Serialization] Json Parse Error line 20: Json Deserialization; unknown member 'EnableGuidedFilterOcclusion' - skipping. 2022-03-06 01:43:29.018288+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.020976+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.021108+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.021210+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.021303+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.021756+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.021864+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.021971+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.022073+0300 MarsamApp[689:48039] throwing -10878 2022-03-06 01:43:29.222669+0300 MarsamApp[689:48250] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1f345e358) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{( "'NSDate' (0x1f34536c0) [/System/Library/Frameworks/CoreFoundation.framework]", "'NSDictionary' (0x1f3453828) [/System/Library/Frameworks/CoreFoundation.framework]" )}'. This will be disallowed in the future. Model is added to the scene Warning (secondary thread): in AppendProperty at line 859 of sdf/path.cpp -- Can only append a property 'preliminary:anchoring:type' to a prim path (/) Warning (secondary thread): in AppendProperty at line 859 of sdf/path.cpp -- Can only append a property 'triggers' to a prim path (/) Warning (secondary thread): in AppendProperty at line 859 of sdf/path.cpp -- Can only append a property 'preliminary:anchoring:type' to a prim path (/) modelEntity for Banana has been loadedAdemás, estas son algunas escenas del objeto de estadísticas oveja objeto rana
Para cargar y renderizar rápidamente, use modelos AR con un número máximo de polígonos de 100K (los modelos con polígonos de 20K a 50K son considerablemente "más rápidos") y texturas de 2K rez máximo (sin embargo, las texturas de 1K son mejores). Una gran cantidad de materiales PBR también impide la carga rápida.