Sphere of visibility

Hi everyone,

I want to build an AR experience that includes a large ground area with trees and grass. However, if possible I’d like there to be a static “sphere of visibility”, (maybe like a Sphere Mask in a material), such that if the ground object (and the trees and grass attached to it) is moved around, only the elements that come within the sphere are visible.

Is this possible without having to create a


sphere mask for every material that’s assigned to the elements in the map?

If you watch the attached video, imagine you’ve “placed” the AR scene thru your iPad onto the table. The ground is animated such that only the stuff on the ground is visible when it’s within this “visibility sphere” I’m asking about. (The camera’s location relative to the elements in the scene will not have any effect on the objects’ visibility.)

(I should add, preferably the objects would fade on and off as they enter/leave the “visibility sphere”.)

Any thoughts/suggestions would be helpful! Thanks for reading!

1 Like

I would use sphere collision in your blueprint to determine where the objects spawn.

For the ground texture, try using a decal using textures in world space.

1 Like

Thanks for your reply!

RE sphere collision, my assumption is that with this method, items would pop on and off, no fading (which I’d prefer if possible).

The decal is an interesting idea, but not sure how well that would work for the grass or trees that are parented to the ground (where there’d be a texture of the leaves and one for the trunk). From what little I know RE decals, I think it’s just a projection of a texture and does not respect the UVs on the surface.

Maybe you can employ THIS technique to “paint” your circle onto the surface.

1 Like

Oh interesting, I’ll have a look at this now. Thanks again for your help!

RE popping on and off, make it so that when the overlap ends use a timeline node to fade out the foliage actors using “create dynamic material instance”.

You can use customdepth on a material to get this effect easily.
Basically you add a sphere mesh around the character using a transparent material on it with a custom depth value. through the sphere’s custom depth you can render the scene. Anything with another depth value renders an image or background color as you are showing. The edges of this sphere can be blurred within the material as well.

https://www.youtube.com/watch?v=JH07z9Ap1hk

Brilliant! This seems like something that might work. I’m starting to resolve myself to the fact that I may have to apply this effect on a per-item basis, rather than a sphere that affects everything within its bounds. Thank you for posting!

I will be able to watch the rest of this later, but my concern is that the depth appears to be locked to the object’s distance from the camera… hopefully there’ll be a way to change from what point the depth is measured. I don’t want the camera’s position to be factored in when things appear/disappear.

not at all, custom depth has nothing to do with distance. the “depth” is just a number you can use as a mask within materials. anything using the same number is on the same mask. Which is why you could look through a sphere with depth 1 and render through it, while having the surroundings on depth 2.

1 Like

He’s right! This is a node we use to give water shaders their depth color.

A bit late to the party but for any future readers, you can still use a sphere mask, but place it inside of a post-process material. Lerp between your unreal scene and your AR texture like so:


The important thing to remember is that you must update your “CameraTexture” Param2D every tick, so create a separate blueprint and feed it into your PostProcess material (as a dynamic material instance) once your AR session has begun:

I’ve tried using custom depth and ARKit in Unreal 5.0 but found some funny behaviour going on… it was many months ago and I don’t quite remember the issue, but IIRC it had to do with the UVs of my stencils getting improperly mapped as soon as I accessed the AR CameraImage texture. Maybe it’s fixed now :upside_down_face: