realitykit

How are the ARKit People Occlusion samples being done?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-12 10:45:12
问题 This may be an obscure question, but I see lots of very cool samples online of how people are using the new ARKit people occlusion technology in ARKit 3 to effectively "separate" the people from the background, and apply some sort of filtering to the "people" (see here). In looking at Apple's provided source code and documentation, I see that I can retrieve the segmentationBuffer from an ARFrame, which I've done, like so; func session(_ session: ARSession, didUpdate frame: ARFrame) { let

What's the difference between ARAnchor and AnchorEntity?

百般思念 提交于 2020-01-02 19:13:50
问题 I'm currently doing some experiments with RealityKit. I've been looking at some sample code, and I'm a bit confused about the differences between ARAnchor and AnchorEntity , and when to use one over the other. So far I know that: Both are anchors that describes a position in the real world. AnchorEntity can also have other Entity 's as children, so you can add model objects directly to the anchor. You can't do this with ARAnchor , you have to add model objects "manually" to the rootNode , and

How to animate a transform in RealityKit

拈花ヽ惹草 提交于 2019-12-25 01:13:04
问题 In my previous question I already found how to put a rotation transform over only one axis on an object, now I want this to be animated. Is there a way to do this in RealityKit? 回答1: Here's how you can animate object in RealityKit (for simplicity I made it using macOS app): import RealityKit class ViewController: NSViewController { @IBOutlet var arView: ARView! let boxAnchor = try! Experience.loadBox() override func awakeFromNib() { boxAnchor.steelBox?.scale = [10, 10, 10] let rotation =

Programmatically setting texture in Scene generated by Reality Composer

为君一笑 提交于 2019-12-23 03:15:53
问题 I am creating a cylinder object using Reality Composer. My requirement is to wrap the cylinder with custom image. Image is dynamically created by the app. I have tried following approach and so far it's not working. After loading the anchor from Experience. Fetch model entity from anchor. Fetch model component from model entity. Add or edit material. Code: // Load the "anchor" scene from the "Experience" Reality File let anchor = try! Experience.loadAnchor() // Add the anchor to the scene

Programmatically setting texture in Scene generated by Reality Composer

送分小仙女□ 提交于 2019-12-23 03:15:17
问题 I am creating a cylinder object using Reality Composer. My requirement is to wrap the cylinder with custom image. Image is dynamically created by the app. I have tried following approach and so far it's not working. After loading the anchor from Experience. Fetch model entity from anchor. Fetch model component from model entity. Add or edit material. Code: // Load the "anchor" scene from the "Experience" Reality File let anchor = try! Experience.loadAnchor() // Add the anchor to the scene

How to generate USDZ file again from ZIP file?

冷暖自知 提交于 2019-12-19 11:31:56
问题 Hello everyone I'm trying to unzip a USDZ file, modify a texture, and then zip the USDZ file again, but it breaks. Is there any special way to zip the file back? Even if I decompress and compress again it stops working and has different file size. I'm using no compression and no encryption to zip the file. One thing I have noticed is that the attribute "Needed to extract" for the USDZ file is "2.0 or later" while my new zip file value is "1.0 or later". Also the files in the original USDZ zip

Adding a material to a ModelEntity programmatically

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 04:14:14
问题 The docs for RealityKit include the structs: OcclusionMaterial , SimpleMaterial , and UnlitMaterial for adding materials to a ModelEntity . Alternatively you can load in a model with a material attached to it. I want to add a custom material/texture to a ModelEntity programmatically. How can I achieve this on the fly without adding the material to a model in Reality Composer or some other 3D software? 回答1: Updated : 21st October 2019 . As you said, there are 3 types of materials in RealityKit

Set text programmatically of an Entity in Reality Composer - iOS 13

旧巷老猫 提交于 2019-12-10 11:09:16
问题 In my iOS app I want to introduce a part of AR using the new Reality Composer. In my project I load a scene with this code: let arView = ARView.init(frame: frame) // Configure the AR session for horizontal plane tracking. let arConfiguration = ARWorldTrackingConfiguration() arConfiguration.planeDetection = .horizontal arView.session.run(arConfiguration) arView.session.delegate = self self.view.addSubview(arView) Experience.loadSceneAsync{ [weak self] scene, error in print("Error \(String

Programmatically setting texture in Scene generated by Reality Composer

余生长醉 提交于 2019-12-07 17:28:33
I am creating a cylinder object using Reality Composer. My requirement is to wrap the cylinder with custom image. Image is dynamically created by the app. I have tried following approach and so far it's not working. After loading the anchor from Experience. Fetch model entity from anchor. Fetch model component from model entity. Add or edit material. Code: // Load the "anchor" scene from the "Experience" Reality File let anchor = try! Experience.loadAnchor() // Add the anchor to the scene arView.scene.anchors.append(anchor) let cylinderEntity : Entity = anchor.cylinder! let cylinderModelEntity

Set text programmatically of an Entity in Reality Composer - iOS 13

别说谁变了你拦得住时间么 提交于 2019-12-06 16:05:18
In my iOS app I want to introduce a part of AR using the new Reality Composer. In my project I load a scene with this code: let arView = ARView.init(frame: frame) // Configure the AR session for horizontal plane tracking. let arConfiguration = ARWorldTrackingConfiguration() arConfiguration.planeDetection = .horizontal arView.session.run(arConfiguration) arView.session.delegate = self self.view.addSubview(arView) Experience.loadSceneAsync{ [weak self] scene, error in print("Error \(String(describing: error))") guard let scene = scene else { return } arView.scene.addAnchor(scene) // THIS IS THE