Post

Replies

Boosts

Views

Activity

USDZ Preview missing AR option after iOS 15
Hi I am trying to display a USDZ model in my app using code similar to that described here: https://developer.apple.com/documentation/arkit/previewing_a_model_with_ar_quick_look however, after updating to iOS 15 and Xcode 13 the option to toggle between the base model view and the AR view is no longer there, the share button is also missing. I am using view inside a navigation view in SwiftUI with code as follows. import SwiftUI struct ModelView: View {   var body: some View {     ARQuickLookView()   } } struct ModelView_Previews: PreviewProvider {   static var previews: some View {     ModelView()   } } import SwiftUI import QuickLook import ARKit struct ARQuickLookView: UIViewControllerRepresentable {   var allowScaling: Bool = true       func makeCoordinator() -> ARQuickLookView.Coordinator {     Coordinator(self)   }       func makeUIViewController(context: Context) -> QLPreviewController {     let controller = QLPreviewController()     controller.dataSource = context.coordinator     return controller   }       func updateUIViewController(_ controller: QLPreviewController,                 context: Context) {     // nothing to do here   }       class Coordinator: NSObject, QLPreviewControllerDataSource {     let parent: ARQuickLookView           init(_ parent: ARQuickLookView) {       self.parent = parent       super.init()     }           func numberOfPreviewItems(in controller: QLPreviewController) -> Int {       return 1     }           func previewController(      _ controller: QLPreviewController,      previewItemAt index: Int) -> QLPreviewItem {       let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("model.usdz")       return url as QLPreviewItem     }         } } struct ARQuickLookView_Previews: PreviewProvider {   static var previews: some View {     ARQuickLookView()   } } Any info on why I don't have these options and how I could get them back would be appreciated. Thanks Louis
2
0
1.2k
Nov ’21
UsdUtils CreateNewUSDZPackage texture bug?
I am very new to USD, I have written a simple Python script to generate a basic USD file containing a blue Sphere, this part works fine, however, I then want to create a USDZ package using this file so have used the UsdUtils CreateNewUSDZPackage function which results in a pink and purple mess instead of the blue from the original file. I would like to know why this is occurring and how to prevent it. The simple script is as follows: from pxr import Usd, UsdGeom, UsdUtils stage = Usd.Stage.CreateNew('HelloWorld.usd') xform = stage.DefinePrim('/hello', 'Xform') sphere = stage.DefinePrim('/hello/world', 'Sphere') extentAttr = sphere.GetAttribute('extent') radiusAttr = sphere.GetAttribute('radius') radiusAttr.Set(2) extentAttr.Set(extentAttr.Get() * 2) sphereSchema = UsdGeom.Sphere(sphere) color = sphereSchema.GetDisplayColorAttr() color.Set([(0, 0, 1)]) stage.GetRootLayer().Save() UsdUtils.CreateNewUsdzPackage('HelloWorld.usd', 'HelloWorldZ.usdz') The produced files look like this: Thank you
1
0
1.1k
Oct ’21
USDZ Preview missing AR option after iOS 15
Hi I am trying to display a USDZ model in my app using code similar to that described here: https://developer.apple.com/documentation/arkit/previewing_a_model_with_ar_quick_look however, after updating to iOS 15 and Xcode 13 the option to toggle between the base model view and the AR view is no longer there, the share button is also missing. I am using view inside a navigation view in SwiftUI with code as follows. import SwiftUI struct ModelView: View {   var body: some View {     ARQuickLookView()   } } struct ModelView_Previews: PreviewProvider {   static var previews: some View {     ModelView()   } } import SwiftUI import QuickLook import ARKit struct ARQuickLookView: UIViewControllerRepresentable {   var allowScaling: Bool = true       func makeCoordinator() -> ARQuickLookView.Coordinator {     Coordinator(self)   }       func makeUIViewController(context: Context) -> QLPreviewController {     let controller = QLPreviewController()     controller.dataSource = context.coordinator     return controller   }       func updateUIViewController(_ controller: QLPreviewController,                 context: Context) {     // nothing to do here   }       class Coordinator: NSObject, QLPreviewControllerDataSource {     let parent: ARQuickLookView           init(_ parent: ARQuickLookView) {       self.parent = parent       super.init()     }           func numberOfPreviewItems(in controller: QLPreviewController) -> Int {       return 1     }           func previewController(      _ controller: QLPreviewController,      previewItemAt index: Int) -> QLPreviewItem {       let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("model.usdz")       return url as QLPreviewItem     }         } } struct ARQuickLookView_Previews: PreviewProvider {   static var previews: some View {     ARQuickLookView()   } } Any info on why I don't have these options and how I could get them back would be appreciated. Thanks Louis
Replies
2
Boosts
0
Views
1.2k
Activity
Nov ’21
UsdUtils CreateNewUSDZPackage texture bug?
I am very new to USD, I have written a simple Python script to generate a basic USD file containing a blue Sphere, this part works fine, however, I then want to create a USDZ package using this file so have used the UsdUtils CreateNewUSDZPackage function which results in a pink and purple mess instead of the blue from the original file. I would like to know why this is occurring and how to prevent it. The simple script is as follows: from pxr import Usd, UsdGeom, UsdUtils stage = Usd.Stage.CreateNew('HelloWorld.usd') xform = stage.DefinePrim('/hello', 'Xform') sphere = stage.DefinePrim('/hello/world', 'Sphere') extentAttr = sphere.GetAttribute('extent') radiusAttr = sphere.GetAttribute('radius') radiusAttr.Set(2) extentAttr.Set(extentAttr.Get() * 2) sphereSchema = UsdGeom.Sphere(sphere) color = sphereSchema.GetDisplayColorAttr() color.Set([(0, 0, 1)]) stage.GetRootLayer().Save() UsdUtils.CreateNewUsdzPackage('HelloWorld.usd', 'HelloWorldZ.usdz') The produced files look like this: Thank you
Replies
1
Boosts
0
Views
1.1k
Activity
Oct ’21