Post

Replies

Boosts

Views

Activity

CustomMaterial crashes on iPad Pro 1st gen
When I launch any RealityKit app that uses a CustomMaterial with a surface shader on my iPad Pro 12.9" 1st gen (Model A1584, iPadOS 16.4.1, built with Xcode 14.3), it crashes with the following error message: -[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5446: failed assertion 'Draw Errors Validation Fragment Function (realitykit::fsSurfacePbr): the offset into the buffer clippingConstants that is bound at buffer index 6 must be multiple of 256 but was set to 128. I can reproduce this with the sample code Altering RealityKit Rendering with Shader Functions as well as with an AR app I'm currently developing. Feedback FB12150033 already submitted to Apple. Replacing all occurrences of CustomMaterial with a SimpleMaterial resolves the crash. Can anyone confirm this? Any ideas for a workaround that lets me keep the shaders? I wouldn't want my app to crash on users of this iPad Pro, but surface shaders are essential in my app.
2
1
899
Apr ’23
Navigation title font cannot be changed
I would like to change my visionOS app's title font to Copperplate, but the Simulator just ignores my code. I know that I'm modifying the right attributes because changing the foregroundColor to red works, it's just the font that always remains the default system title font and size. Here's my code, where everything in init() seems to have no effect at all: struct ContentView: View { @Environment(ViewModel.self) private var model init() { let appearance = UINavigationBarAppearance() appearance.titleTextAttributes = [.font: UIFont(name: "Copperplate", size: UIFont.preferredFont(forTextStyle: .title1).pointSize)!] UINavigationBar.appearance().standardAppearance = appearance UINavigationBar.appearance().scrollEdgeAppearance = appearance } var body: some View { @Bindable var model = model NavigationStack(path: $model.navigationPath) { BooksView() .tabItem { Label("Books", systemImage: "book") } .navigationTitle("Title Test") // .navigationDestination is also provided of course } } } However, configuring the appearance like this works fine: appearance.titleTextAttributes = [.foregroundColor: UIColor.red] Is this a limitation of the visionOS Simulator, or of visionOS, or am I doing something wrong?
1
0
1.2k
Nov ’23
NavigationLink larger than its contents
I have an image (or filled rectangle, or anything) placed inside a NavigationLink, but it doesn't get its full width, instead it's the width minus the corner radius. Here's my simplified code: ScrollView(.vertical, showsIndicators: false) { LazyVGrid(columns: columns, spacing: 20) { ForEach(children, id: \.self) { childTopic in NavigationLink(value: childTopic) { Image(childTopic.previewImage) .resizable() .scaledToFill() .frame(maxWidth: 300, maxHeight: 150, alignment: .top) .clipShape(RoundedRectangle(cornerRadius: 15.0, style: .circular)) } .buttonBorderShape(.roundedRectangle(radius: 15.0)) .padding(20.0) } } .padding() } The screenshot shows what each list items look like. Is it possible to make the image fill the NavigationLink? PS: I played around with .buttonStyle(.plain) on the NavigationLink, but on visionOS it still gets an overlay when the user looks at it - which is a good thing, but larger than the image.
0
0
472
Dec ’23
EnvironmentLightingConfigurationComponent not working
Has anyone gotten EnvironmentLightingConfigurationComponent to work? I tried the code from https://developer.apple.com/documentation/realitykit/environmentlightingconfigurationcomponent to prevent a planet from being lit by the environment. My goal is that the side that isn't lit by the star appears pitch black. However, the code seems to have no effect on visionOS 2 and iPadOS 18 (I tried betas 1 through 4, on device, built with Xcode 16 beta 4). No matter if there is a PointLight or no light at all in the scene, no matter if I use SimpleMaterial or PhysicallyBasedMaterial, no matter if I use a texture or a color on the sphere. I filed a bug report, it's FB14470954. Or am I doing something wrong? Here's my code: var material = PhysicallyBasedMaterial() if let tex = try? await TextureResource(named: "planet.jpg") { material.baseColor = .init(texture: .init(tex)) material.emissiveIntensity = 0 let sphereMesh = MeshResource.generateSphere(radius: 0.5) let entity = ModelEntity() entity.components.set(ModelComponent(mesh: sphereMesh, materials: [material])) entity.position = [-1, 1.0, -1.0] let envLightingConfig = EnvironmentLightingConfigurationComponent(environmentLightingWeight: 0) entity.components.set(envLightingConfig) content.add(entity) }
1
1
608
Jul ’24
USDZ models look broken on iOS 18 / visionOS 2 beta
I noticed that with the 4th betas of iOS 18 and visionOS 2, some USDZ models' texture mapping looks completely broken. The issue occurs only with a device, not with the Simulator. It's a regression, the models look fine with iOS 17.5.1 and visionOS 1.2. The issue occurs if I load a model as an Entity in a RealityView iOS or visionOS, or in a SwiftUI 3DModel view on visionOS. Has anyone seen this too? Is there a workaround? I filed a bug report with a minimal example project, it's FB14473756. Screenshot on Vision Pro device: Screenshot on Vision Pro Simulator:
1
2
785
Jul ’24
Game Center breaks RealityView world tracking
Has anyone come across the issue that setting GKLocalPlayer.local.authenticateHandler breaks a RealityView's world tracking on iOS / iPadOS 18 beta 5? I'm in the process of upgrading my app to make use of the much appreciated RealityView unification, using RealityView not only on visionOS but now also on iOS and iPadOS. In my RealityView, I enable world tracking on iOS like this: content.camera = .worldTracking However, device position and orientation were ignored (the camera remained static) and there was no camera pass-through. Then I discovered that the issue disappeared when I remove the line GKLocalPlayer.local.authenticateHandler = { viewController, error in // ... some more code ... } So I filed FB14731139 and hope that it will be resolved before the release of iOS / iPadOS 18.
2
1
553
Aug ’24
RealityView world tracking without camera feed?
Is it possible with iOS 18 to use RealityView with world tracking but without the camera feed as background? With content.camera = .worldTracking the background is always the camera feed, and with content.camera = .virtual the device's position and orientation don't affect the view point. Is there a way to make a mixture of both? My use case is that my app "Encyclopedia GalacticAR" shows astronomical objects and a skybox (a huge sphere), like a VR view of planets, as you can see in the left image. Now that iOS 18 offers RealityView for iOS and iPadOS, I would like to make use of it, but I haven't found a way to display my skybox as environment, instead of the camera feed. I filed the suggestion FB14734105 but hope that somebody knows a workaround...
4
1
710
Aug ’24