Arkit: Plot a Node at a Specific Pixel at a Specific Z Distance from Camera

ARKit: Place a Node right behind a Node

Adding the red node as a child of the blue one with coordinates to (0.0,0.0,-0.05) and then making the blue node face the camera with "SCNBillboardConstraint" should do the trick

ARKit – How to know if 3d object is in the center of a screen?

I solved problem with another way:

 let results = self.sceneView.hitTest(screenCenter!, options: [SCNHitTestOption.rootNode: parentnode])

where parentnode is the parent of target node, because I have multiple nodes.

Darken/Lighten ARKit camera feed behind objects

Your option B doesn't work for two reasons:

  1. the scene view is opaque, so there's nothing behind it for a partially transparent background color to blend with.
  2. sceneView.scene.background is what actually displays the camera image, so if you set it to a color you're not displaying the camera image at all anymore.

Some other options (mostly untested) you might look into:

  • As referenced from the answer you linked, use SCNTechnique to set up multipass rendering. On the first pass, render the whole scene with the excludeCategoryMask (and your scene contents) set up to render nothing but the background, using a shader that dims (or blurs or whatever) all pixels. On the second pass, render only the node(s) you want to appear without that shader (use a simple pass-through shader).

  • Keep your option B, but make the scene view non-opaque. Set the view's backgroundColor (not the scene's background) to a solid color, and set the transparency of the scene background to fade out the camera feed against that color.

  • Use geometry to create a "physical" backdrop for your scene — e.g. an SCNPlane of large size, placed as a child of the camera at some fixed distance that's much farther than any other scene content. Set the plane's background color and transparency.

  • Use multiple views — the ARSCNView, made non-opaque and with a clear background, and another (not necessarily an SceneKit view) that just shows the camera feed. Mess with the other view (or drop in other fun things like UIVisualEffectView) to obscure the camera feed.

  • File a bug with Apple about sceneView.background not getting the full set of shading customization options that nodes and materials get (filters, shader modifiers, full shader programs) etc, without which customizing the background is much more difficult than customizing other aspects of the scene.

ARKit – How to detect the colour of specific feature point in sceneView?

At the moment it's not possible to get a colour of a real-world object under feature point using ARKit methods (the same way like you saw in many compositing apps). There's no ARKit method allowing you multiply an Alpha of a feature point by RGB value of corresponding pixel in a video stream.

Sample Image

.showFeaturePoints is an extended debug option ARSCNDebugOptions for an ARSCNView. This option just allow you to show detected 3D feature points in the world.

@available(iOS 11.0, *)
public static let showFeaturePoints: SCNDebugOptions

But I'm sure that you can try to apply a CIFilter to ARKit camera feed containing feature points.

Feature points in your scene are yellow, so you can use Chroma Key Effect to extract an Alpha channel. Then you need to multiply this Alpha by RGB from camera. So you'll get color-coded feature points.

Sample Image

You can alternatively use a CIDifferenceBlendMode op from Core Image Compositing Operations. You need two sources – one with feature points and another without them. Then you have to modify this result of Difference op and assign it to Alpha channel before multiplication.



Related Topics



Leave a reply



Submit