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:
- the scene view is opaque, so there's nothing behind it for a partially transparent background color to blend with.
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 theexcludeCategoryMask
(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'sbackground
) to a solid color, and set thetransparency
of the scenebackground
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 likeUIVisualEffectView
) 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.
.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.
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
How to Show Two Row of Text in a Menu Bar App in MAC Os
Can't Hide Status Bar in Avplayerviewcontroller's Portrait Mode
Indent Second Line of UIlabel (Swift)
Pass Data from Tableviewcontroller to Another Tableviewcontroller in Swift
Swift-Making an Sknode Simply "Move Forward" on an Angle
Use Tableviewcontroller Inside Skscene
Firebase Data Retrieval - Edit Annotation
Will a a Weak Wrapper Class Throw Off a Hashable Based Collection When The Wrapped Value Is Set Nil
Uisearchcontroller Hiding Status Bar on iOS 11 Swift 4
How to Remove The Fading Animation on .Ondelete Swiftui
Nssavepannel - How to Restrict User to Only Save One One Set Directory
How to Add Skspritenode in a Loop
Multi-Users Chat Room Data Structure in Firebase Database
Customize Mglpolyline Using Mapbox
Touch Sprite, Make It Jump Up Then Fall Down Again(Repeat as Many Times as Spritenode Is Tapped.)
Hide Placeholder Programatically Using Swift 3X
How to Make Text Appear in Centre of The Image
Write Data to Firebase in The Background After Retrieving Steps with Healthkit's Background Delivery