arkit

How to change SCNPlane color as clear color

China☆狼群 提交于 2019-12-05 17:12:47
I am working on a ARKit project which needs Ripple animation effect when tapped on Horizontal Plane. For that I have took UIView object and pass that as contents for material of SCNPlane object. I have added Ripple animation to UIView object. Everything works fine. But I can't change the SCNPlane colour to clear color. I can use transparency property for the material. But it is hiding Ripple animation too. So, what I need here is, the background colour of SCNPlane object should be transparent and only Ripple animation should appear to user. Can someone help me on this. This is my code. let

Add image to AR Resources on the fly for image recognition

允我心安 提交于 2019-12-05 16:35:13
问题 ARKit 1.5 introduces image recognition. In the code you have to create a Set of the reference images like this: let referenceImages = ARReferenceImage.referenceImages(inGroupNamed: "AR Resources", bundle: nil) and then images contained in the Set can be recognised. I wanted to know if it is possible to add images on the fly to this AR Resources folder. For example a user could take a picture and send it to a server, it is then recognised by the ARKit . Or a user could receive a set of images

Why is SCNNode “jiggling” when dropped onto SCNPlane?

半城伤御伤魂 提交于 2019-12-05 14:49:31
I have a SCNPlane that is added to the scene when a sufficient area is detected for a horizontal surface. The plane appears to be placed in a correct spot, according to the floor/table it's being placed on. The problem is when I drop a SCNNode(this has been consistent whether it was a box, pyramid, 3D-model, etc.) onto the plane, it will eventually find a spot to land and 99% start jiggling all crazy. Very few times has it just landed and not moved at all. I also think this may be cause by the node being dropped and landing slightly below the plane surface. It is not "on top" neither "below"

ARSessionConfiguration unresolved in Xcode 9 GM

早过忘川 提交于 2019-12-05 08:16:42
I have created an ARKit project using a beta version of Xcode 9, which I was able to run on my real device without issues. Yesterday, I upgraded to Xcode 9 GM, and without touching anything, Xcode shows multiple errors, saying it does not know ARSessionConfiguration i.e.: Use of undeclared type 'ARSessionConfiguration' and: Use of undeclared type 'ARWorldTrackingSessionConfiguration' ...for this code: let session = ARSession() var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration() I have imported ARKit and am using the ARSCNViewDelegate in my ViewController. When

invalid reference image arkit 1.5

蹲街弑〆低调 提交于 2019-12-05 04:11:05
I am running the apple sample project of ARKit 1.5 Image detection but when I place my reference image inside AR Resource folder and run the app I get following error: Make sure all reference images are greater than 100 pixels and have a positive physical size in meters. I don't find any predefined requirements of how should the image be, can anyone explain the required attributes of the image? As in Apple's documentation For each image, use the inspector to describe the physical size of the image as you’d expect to find it in the user’s real-world environment, and optionally include a

SceneKit nodes aren't changing position with scene's root node

北城以北 提交于 2019-12-05 04:02:26
问题 I'm using SceneKit with ARKit, and right now have a simple app where I tap on the screen and it adds an ARAnchor and a SCNNode to my scene. At some point, I'm going to want to move the entire scene, so I tried changing sceneView.scene.rootNode.position.x += 10 to test this out. If I call this on any particular node, that node does move appropriately. But calling this on rootNode , nothing happens, where I'd expect every child node (which is every node in the scene) to move along with it. Why

ARKit / SpriteKit - set pixelBufferAttributes to SKVideoNode or make transparent pixels in video (chroma-key effect) another way

末鹿安然 提交于 2019-12-05 02:59:53
My goal is to present 2D animated characters in the real environment using ARKit . The animated characters are part of a video at presented in the following snapshot from the video: Displaying the video itself was achieved with no problem at all using the code: func view(_ view: ARSKView, nodeFor anchor: ARAnchor) -> SKNode? { guard let urlString = Bundle.main.path(forResource: "resourceName", ofType: "mp4") else { return nil } let url = URL(fileURLWithPath: urlString) let asset = AVAsset(url: url) let item = AVPlayerItem(asset: asset) let player = AVPlayer(playerItem: item) let videoNode =

Setting ARKit Orientation via Swift

萝らか妹 提交于 2019-12-05 02:54:18
问题 I am developing an ARKit app with OpenGL , so working directly with ARKit and not using SceneKit. By default, ARKit is set to landscape orientation, but I have been unable to track down any documentation or examples to rotate to portrait. SceneKit example works in portrait but the Metal example only works in landscape. Is it possible to change the ARKit tracking orientation? 回答1: I was able to solve this in the application logic by multiplying the camera matrix by a quaternion that is rotated

Render a 3D model (hair) with semi-transparent texture in SceneKit?

和自甴很熟 提交于 2019-12-04 22:52:43
I'm trying to render a 3D model in SceneKit but it looks incorrect. For example this model (it's an SCN file with texture and you can reproduce it in your Xcode): In Xcode Scene Editor it is rendered like this: Transparency -> Mode -> Dual Layer Double Sided = true If I turn off the "Write depth" option, it will look like this: But there are also some issues because it I see only "the lowest layer" of haircut. I think this should be possible. How to do it right? The reason that in your 3D model some strands of hair popped out when viewed from different angles is quite usual for SceneKit: your

Get “[SceneKit] Error:” when set AVPlayer to SCNMaterial.diffuse.contents

一曲冷凌霜 提交于 2019-12-04 21:49:15
According Apple's docs, SCNMaterial.diffuse.contents can be a AVPlayer . In this case material appear content of video. Everything seems ok but I get several sceneKit error logs: [SceneKit] Error: Could not get pixel buffer (CVPixelBufferRef) Below is my code. Move [_player play] to viewWillAppear does't help. - (void)viewDidLoad { [super viewDidLoad]; self.boxNode = [self.sceneView.scene.rootNode childNodeWithName:@"box" recursively:YES]; NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/VRF_SuLie.MP4"]; AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL