Make Static Mesh visible only when within specific range. How?

Hi everyone! :slight_smile:

I’m a bit of a newb with Blueprinting, so I was hoping someone could offer some advice on how to achieve this effect:

Imagine a house on a flat grassy field, with a sky above. The house is 20m long, 20m wide, 20m tall and has a single room as interior. A character is standing inside the house, right in the middle, so that he is 10m from any nearest wall.

Standing in the middle of the room, the entire house should be invisible to the character. Only when the character walks within, lets say 2m of the wall, does the wall become visible. But only parts of the wall within 2m become visible, the rest of the house remains invisible.

So, to summarise: How to make an object visible only when within a specified distance from the Camera? And only parts of that object within the specified distance become visible.

Any advice or suggestions on how to do this would be awesome. Many thanks! :slight_smile:

Hello again I messaged you a few times on skype but guess you didn’t want to know

As for you’re question it depends what you’re after as you’re description is a bit confusing

If you are talking about culling things so they are not rendered outside the cameras viewing plane you need to play with the camera settings

http://timhobsonue4.snappages.com/culling-visibilityculling.htm

In unity you could have culling masks and layers for each thing you wanted to render . Not sure if unreal has the same things though as I think the render pipeline is different

But like I said try playing with the camera settings like view frustrum etc first.

Could also look into using custom depth

So it would work in a similar way to a torch beam facing the wall . The stuff directly in the light beam would be rendered and then the stuff outside of the torch circle in the shadows would be culled/ not renders

As for setting visibility of the meshes easiest method is probably to line trace out from you’re camera and see what it hits . Check the distance if the distance is less than the desired visibility range then set static mesh to visible