arkit

How to use SCNTechnique to create a “masked” portal effect in SceneKit / ARKit?

巧了我就是萌 提交于 2019-12-23 03:36:10
问题 I'm trying to wrap my head around how to use SCNTechnique with Scenekit. The effect I'm trying to create can easily be achieved in Unity by adding a custom shader to two materials, making objects with the "filtered" shader to only be visible when it is seen through the other shader (the portal). I've followed this tutorial to create this in Unity: https://www.youtube.com/watch?v=b9xUO0zHNXw I'm trying to achieve the same effect in SceneKit, but I'm not sure how to apply the passes. I'm

ARKit Perspective Rendering

给你一囗甜甜゛ 提交于 2019-12-23 03:17:31
问题 I am working on a perspective problem with ARKit that I encountered in one of my projects. I explain you: in the photo below, I display a 3D model along the lane, there are small 3D boxes every 2 meters. Then, I place indicators at the level of these boxes, as you can see on the photo, the 3D models shift and do not seem to be in the right place when we move away from the boxes. I would like to know if this comes from ARKit or simply from my way of displaying this model. Knowing that the 3D

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 draw a line between two points in SceneKit?

旧巷老猫 提交于 2019-12-23 03:11:27
问题 If I have two points in SceneKit (e.g. (1,2,3) and (-1,-1,-1) ). How do I draw a line between the two? I see that there is a SCNBox object I may be able to use, but that only allows me to specify the center (e.g. via simdPosition ). The other ways to modify it are the transform (which I don't know how to use), or the Euler angles (which I'm not sure how to calculate which ones I need to use). 回答1: Just build a custom geometry using SCNGeometryPrimitiveType.line : let vertices: [SCNVector3] =

How to place 3D model using ARKit iOS 11 with some custom background view without using camera?

六月ゝ 毕业季﹏ 提交于 2019-12-23 02:36:05
问题 I am working on an Augmented Reality iOS app for which i am using ARKIT of iOS 11 beta. I am using ARSCNView(SceneKit) to render my .scn object. I have followed the sample given by apple in order to create an ARSession(https://developer.apple.com/sample-code/wwdc/2017/PlacingObjects.zip). Is it possible to place the 3D model with custom background instead of camera? Like user can select the background color or can provide custom 2D photos as background? 回答1: Your view has a scene property

Why would Xcode show MUCH more memory use than Instruments for SceneKit app?

為{幸葍}努か 提交于 2019-12-22 19:23:11
问题 I'm trying to debug why our SceneKit-based app is using so much memory but Xcode and Instruments / Allocations seem to have very different values for the amount of memory being used. When I look in Xcode I see something like 600 MB but when I transfer the same running session over to Instruments / Allocations, I see a very different number for persistent bytes, like 150 MB . Which one is correct? Why the difference? Are they measuring different things? (Regardless of whether I Transfer an

ARKit billboarding effect with SceneKit

可紊 提交于 2019-12-22 18:43:21
问题 I am looking to add a billboarding effect that is similar to this application: https://twitter.com/marpi_/status/897130955105644544 I would like SCNodes that use SCNText geometry to always face the camera. I have attempted with out success: SCNLookAtConstraint with sceneView.pointOfView as the target, but this rotates the node to face away from the camera, resulting in backwards text, and unable to change the nodes position or euler angle. Out of the box, an SKLabelNode will always face the

ARKit: How to tell if user's face is parallel to camera

痞子三分冷 提交于 2019-12-22 12:02:30
问题 In my Swift / ARKit / SceneKit project, I need to tell if the user's face in front-facing camera is parallel to the camera. I was able to tell horizontal parallel by comparing the left and right eyes distance (using faceAnchor.leftEyeTransform and the worldPosition property) from the camera. But I am stuck on vertical parallel. Any ideas, how to achieve that? 回答1: Assuming you are using ARFaceTrackingConfiguration in your app, you can actually retrieve the transforms of both the ARFaceAnchor

How to change SCNPlane color as clear color

ε祈祈猫儿з 提交于 2019-12-22 08:12:51
问题 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