Post

Replies

Boosts

Views

Activity

Reply to Sheet-like presentation on the side on iPad
I have also been trying to build a side sheet like this and so far the only way I have found to do it is the same as you by placing a NavigationStack as an overlay with a glass effect background. But I have run into a problem with that. If I have a button with a menu, when the menu is presented, the glass background behind the NavigationStack disappears. This doesn't happen if I use a regular sheet.
Topic: UI Frameworks SubTopic: SwiftUI
1w
Reply to Add light to a RealityView on visionOS
I used this code that I got from https://blog.learnxr.io/xr-development/getting-started-with-apple-vision-os-development-part-2 extension Entity { /// Adds an image-based light that emulates sunlight. /// /// This method assumes that the project contains a folder called /// `Sunlight.skybox` that contains an image of a white dot on a black /// background. The position of the dot in the image dictates the direction /// from which the sunlight appears to originate. Use a small dot /// to maximize the point-like nature of the light source. /// /// Tune the intensity parameter to get the brightness that you need. /// Set the intensity to `nil` to remove the image-based light (IBL) /// from the entity. /// /// - Parameter intensity: The strength of the sunlight. Tune /// this value to get the brightness you want. Set a value of `nil` to /// remove the image based light from the entity. func setSunlight(intensity: Float?) { if let intensity { Task { guard let resource = try? await EnvironmentResource(named: "Sunlight") else { return } var iblComponent = ImageBasedLightComponent( source: .single(resource), intensityExponent: intensity) // Ensure that the light rotates with its entity. Omit this line // for a light that remains fixed relative to the surroundings. iblComponent.inheritsRotation = true components.set(iblComponent) components.set(ImageBasedLightReceiverComponent(imageBasedLight: self)) } } else { components.remove(ImageBasedLightComponent.self) components.remove(ImageBasedLightReceiverComponent.self) } } } For my sunlight I used this image that I put into Sunlight.skybox. That added light to my scene above.
Topic: Graphics & Games SubTopic: RealityKit Tags:
Nov ’23
Reply to building for xr_os simulator but the file (Libraries/libiphone-lib.a[5](MeshSkinningNEON64_blzfc.0) is built for xros.
I had similar issues when I build my project for the first time. You will need to rebuild all of your dependencies for visionOS and visionOS simulator. I was having issues building a universal binary for one of my dependencies. To get my app up and running, I swapped out the library file with the correct one based on what I was targeting. Once I had it working, I was able to go back and get the universal build for the library working.
Aug ’23
Reply to VisionOS Game Development
Depending on the type of game you are building, you will likely want to use SceneKit, SpriteKit, or RealityKit. SwiftUI is the future, so my recommendation is to start there. Though there are things it does not support and then you have to bridge over to UIKit in those cases.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’23
Reply to Image Input for ShaderGraphMaterial
Here is what I did to send an image to ShaderGraphMaterial. let img = getSomeUIImage() let mat = getShaderGraphMaterial() if let cgImg = img.cgImage { let texture = try TextureResource.generate(from: cgImg, options: TextureResource.CreateOptions.init(semantic: nil)) try mat.setParameter(name: "cover", value: .textureResource(texture)) }
Topic: Graphics & Games SubTopic: RealityKit Tags:
Aug ’23
Reply to Render material on the inside of a sphere.
I create a sphere that I use for sky and display an image on the inside of it by changing the scale property on the Entity. Here is how I create a very large sphere and have the material rendered on the inside of it. let entity = Entity() entity.components.set(ModelComponent( mesh: .generateSphere(radius: 100000), materials: [material] )) // Ensure the texture image points inward at the viewer. entity.scale *= .init(x: -1, y: 1, z: 1)
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’23
Reply to 'PointLight' is unavailable in xrOS
I see that the documentation has been updated to show that PointLight, DirectionalLight, and SpotLight are not available on visionOS. Does anyone know how to add a light source to a RealityKit scene on visionOS? I am working on a fully immersive experience and I need to add light from the sun to my scene, but I can't figure out how to do it.
Topic: Graphics & Games SubTopic: RealityKit Tags:
Jul ’23