# AR Mesh Occlusion Solutions

**URL:** <https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883>\
**Category:** Mobile\
**Tags:** unreal-engine, iOS\
**Created:** [November 17, 2018, 8:00am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883 "2018-11-17T08:00:36Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_9545eedc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9545eedc](https://forums.unrealengine.com/u/anonymous_user_9545eedc)\
**Post date:** [November 17, 2018, 8:00am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/1 "2018-11-17T08:00:36Z")

</div>

Im playing around with the AR template and was wondering if anyone has come up with a solution for hiding meshes that have been placed in the world in another room. I don’t want my meshes to follow the player through walls. I want the surface planes detected to be stationary in real world space. Any suggestions?

---

<div class="post-metadata">

**Author:** ![Antidamage](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/antidamage/32/918692_2.png) [@Antidamage](https://forums.unrealengine.com/u/Antidamage)\
**Post date:** [November 17, 2018, 9:55am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/2 "2018-11-17T09:55:51Z")

</div>

I haven’t tried AR Kit but do you get a depth buffer from the camera? Could you use that in a post-process material to draw the camera feed over occluded objects?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9545eedc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9545eedc](https://forums.unrealengine.com/u/anonymous_user_9545eedc)\
**Post date:** [November 17, 2018, 1:22pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/3 "2018-11-17T13:22:25Z")

</div>

@Antidamage I’ll look into that thanks dude.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9545eedc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9545eedc](https://forums.unrealengine.com/u/anonymous_user_9545eedc)\
**Post date:** [November 18, 2018, 1:58pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/4 "2018-11-18T13:58:16Z")

</div>

@Antidamage What you’ve mentioned makes perfect sense, but I have a question for you. How would you determine what to cover up and when to do it? Based on GPS data? Based on phone position from the detected plane surfaces themselves? I want to be able to place things down or have things appear in the players current room and play space and then have them leave to another room and interact with other objects. I want the objects in the first room to be occluded and remain intereactable for when the player returns to them.

Right now on the AR template It appears that the detected surfaces that objects can be placed on are following the camera. For example if I place an object on the ground and it appears 5 feet from me on the floor. If I walk into another room 10 feet away the object still appears 5 feet from me. I’ll test again to make sure this is the behavior i’m seeing.

If there something I need to do to detach the camera from the world origin? I feel like logic would state that i’m not actually moving around in virtual space. I’m just standing at the origin in virtual space and when I move in real world space all i’m doing is changing the video feed from the camera. Does that make sense?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9545eedc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9545eedc](https://forums.unrealengine.com/u/anonymous_user_9545eedc)\
**Post date:** [November 18, 2018, 4:44pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/5 "2018-11-18T16:44:20Z")

</div>

@Antidamage I was just retesting this… It had been a few days since I looked at the results i was getting. What I mentioned above is incorrect. I am moving away from the objects and they are staying in place. The problem is exactly what you stated with the camera buffer. Thanks for the heads up. I’m currently tackling the haptic feedback, but once that’s done I will be onto this I think.

---

<div class="post-metadata">

**Author:** ![Antidamage](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/antidamage/32/918692_2.png) [@Antidamage](https://forums.unrealengine.com/u/Antidamage)\
**Post date:** [November 18, 2018, 9:43pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/6 "2018-11-18T21:43:06Z")

</div>

As I mentioned, can you get a depth buffer from the camera? If so it’s just math inside a post-process shader:

Lerp(PostProcess0, CameraFeed, clamp((SceneDepth - CameraDepth) / TransitionDistance));

Given that ARKit plots the surfaces in general I’m sort of surprised that it isn’t building some kind of occlusion mesh to do this automatically. If so it might live in (or can be pushed into) the custom depth buffer, which would be even better than the camera depth feed if such a thing exists.

---

<div class="post-metadata">

**Author:** ![6r0m](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/6r0m/32/1194563_2.png) [@6r0m](https://forums.unrealengine.com/u/6r0m)\
**Post date:** [April 25, 2019, 12:24pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/7 "2019-04-25T12:24:17Z")

</div>

hi guys, anybody achieved this stuff?

---

<div class="post-metadata">

**Author:** ![CosmicLobster](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cosmiclobster/32/1211357_2.png) [@CosmicLobster](https://forums.unrealengine.com/u/CosmicLobster)\
**Post date:** [July 22, 2019, 1:35pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/8 "2019-07-22T13:35:56Z")

</div>

Hi,

yes, I had good results with a procedural mesh created at runtime, based on tracked geometry.  
The vectors from the tracked geometry are fed to the procedural mesh creation. It then needs to be triangulated. I calculated that in blueprints, performance was no issue.  
Then apply AR camera material on it. It occludes and can receive shadows.

Alternatively just get the extents of a tracked plane and scale a plane.

This approach might become obsolete in UE4.23. It finally implemented mobile AR in the MR MESH COMPONENT.  
We’ll see what it can do. The UE4.23 preview version 2 is still too buggy and it does not package, no chance to test it.

Mind, that the tracked geometry of current generation mobile AR is not very accurate. Recognizing a wall and the edges of an open door is hit or miss, especially on lower end devices.  
2020 Apple will likely implement accurate depth measuring in their devices, less depending on enough light. Similar to their current TrueDepth Camera technology in iPhoneX and iPadPros, but reaching several meters, not like currently only some cm for close face detection.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_9545eedc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_9545eedc](https://forums.unrealengine.com/u/anonymous_user_9545eedc)\
**Post date:** [July 29, 2019, 6:55pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/9 "2019-07-29T18:55:31Z")

</div>

I had set this aside many months ago, because I was getting a ton of mac specific development errors. maybe its time to pick up back up.

---

<div class="post-metadata">

**Author:** ![NDmitriy98](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NDmitriy98](https://forums.unrealengine.com/u/NDmitriy98)\
**Post date:** [October 16, 2020, 10:51am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/10 "2020-10-16T10:51:17Z")

</div>

This can be a solution

> **[Render in main pass AR (Android)](https://forums.unrealengine.com/questions/988932/render-in-main-pass-ar-android.html)**
>
> Hi! I’m trying to do invisible occluder in my Handheld AR project. When I disable “Render in main pass” and enable “Render in Depth pass” I expect the cube become transparent and it will occlude the red objects but it only works when I enable Custom...

---

<div class="post-metadata">

**Author:** ![Seldens](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seldens](https://forums.unrealengine.com/u/Seldens)\
**Post date:** [January 11, 2022, 9:21am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/11 "2022-01-11T09:21:11Z")

</div>

Hello,

Try to check this box in your project settings, rendering section :

 ![Capture d’écran (28)](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/8/38532aba25dbe9583728af5bf72558f44d4d399d.png)

In your session config, apply those settings :

 ![Capture d’écran (29)](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/6/a629d610d10396beb9bb83544ce71ef4e65c77f5.png)

It worked for me, hope it will help your

---

<div class="post-metadata">

**Author:** ![Cektantwork](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cektantwork/32/717411_2.png) [@Cektantwork](https://forums.unrealengine.com/u/Cektantwork)\
**Post date:** [January 24, 2022, 12:45pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/12 "2022-01-24T12:45:16Z")

</div>

it’s work only in Android with DepthApi. If you try use it in IOS with lidar than you must edit some code in unreal engine, At least that’s how it was with me.

---

<div class="post-metadata">

**Author:** ![RobJinn](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/robjinn/32/715780_2.png) [@RobJinn](https://forums.unrealengine.com/u/RobJinn)\
**Post date:** [January 24, 2022, 12:52pm UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/13 "2022-01-24T12:52:30Z")

</div>

Hi Cektantwork, can you explain me what part of the code did you change? I work with IOS too, in blueprint and I really can’t find how to make the depth work … 😕

---

<div class="post-metadata">

**Author:** ![DEVxXR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/devxxr/32/1067984_2.png) [@DEVxXR](https://forums.unrealengine.com/u/DEVxXR)\
**Post date:** [July 4, 2022, 11:30am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/14 "2022-07-04T11:30:19Z")

</div>

Hey , can you please explain what part you did for iOS for occlusion? It would be great help .  
Thanks in Advance

---

<div class="post-metadata">

**Author:** ![Origins](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Origins](https://forums.unrealengine.com/u/Origins)\
**Post date:** [December 13, 2025, 6:07am UTC](https://forums.unrealengine.com/t/ar-mesh-occlusion-solutions/118883/15 "2025-12-13T06:07:23Z")

</div>

How about Face Tracking Occlusion
