ARKit Masking and Blackhole

Probably current state of ARKit does not yet allow some kind of easy masking. But not sure if any of you knows some kind of clever hack using Metal material of some sort.


I was wondering the other day if we can use Fog black and white gradation to kind of mask out the AR contents. Say, so that objects that are too far away does not overlap in a distracting way, thus simulating some kind of distance depth masking.


Occlusion is not yet possible, not sure if iPhone X / iPhone 8 / iPhone Pro allow this next year.

I am also wondering how 3D objects in SceneKit does it.


I think in another word, it is called "blocker" object. Some kind of ways to make Object B to block object A, but making everything transparent, leaving object A becomes hollow or cropped or masked.


Any idea? 😕 I have seen few demos of this happening in ARKit, but via Unity. I am using only XCode. There should be a masking or something.

Further research found out that MANY users use some kind of hack in Unity to create this Black Hole material. They call it DEPTH MASKING:

http://wiki.unity3d.com/index.php/DepthMask


Thread:

https://gamedev.stackexchange.com/questions/72978/shader-that-cuts-hole-through-all-geometry


Compositing in 3D and in realtime using 3D objects is still an area that is new for me. Supposedly, we could at least think the projected image of original life image video stream + ARKit layer + something else == flat images, they could be layered and composed into final view for user.


Masking is interesting might be related to other area in Apple XCode Kit.


Apple devs, any clue or hint?

Not sure how transparent of B you want to see A? You may simply set opacity of B to any values between 0 and 1.

If you don't want to change opacity, you can still make A "pop" up on B by setting properties readsFromDepthBuffer and renderingOrder (for B to show it behind A).

If you want to make A looks being marked, you may change it materials and / or light, or use a simple mark color shader which could be searched out and downloaded from somewhere.

All above techs are simple and fast. However you cannot show A in more complicated ways such as half-marked half-normal. I guess you may need a complicated metal / shader to do that. Someone suggested to convert 3D objects into 2D objects (SpriteKit) to process but it may slow down the app.


Just 5 cents

ARKit Masking and Blackhole
 
 
Q