How do I make a box mesh whose interior is visible but exterior is invisible?

So, basically I have a hollow/open box mesh (basically, the box has an opening, 5 faces instead of 6) that I created in Blender. This mesh consists of two separate meshes put together in a single Blueprint. One mesh is the exterior of the box (created by letting all 5 faces be a flat plane mesh) and the other mesh is the interior of the box (same exact mesh as the first one but with it’s normals inverted/flipped).

Now, I want to make it so that the player (or any camera really) can only see the interiors of the box (interior mesh) if they are looking “into” the box (through the opening) or are standing inside the box itself. The interior should not be visible if you look at it from other angle (at any of the 5 faces). The exterior of the box should NEVER be visible. Basically, the exterior of the box should “isolate” the interior preventing it from being viewable from the “outside”.

The solution also needs to be multiplayer-friendly. Basically, if Player 2 is standing outside the box and Player 1 is overlapping the opening/standing inside the box. Player 2 should not be able to see the box or it’s interiors.

I hope you understand what I mean. Do you have any ideas of how this can be achieved?

Thanks!

I can see a way, but it is complicated to setup. Put simply, the method would involve creating a depth mask which only includes the exterior of the box. this mask needs to be a texture. This texture mask can be projected from the camera onto the world in a shader. you would use this projection in the shader for all objects that should have their visibility cloaked by the box exterior. If an objects distance to the camera is less than the distance of the box exterior, is is invisible, and you would use the opacity mask slot of the shader to make it so.

I don’t actually need any objects inside the box to be invisible. I just need the insides of the box to be visible but not the outsides (and for the outside of the box to isolate the insides, making the insides invisible when viewing them from outside the box if that makes sense).

  • Set Collision Box at required place,
  • once character overlaps with this, Spawn your 5 faces Box actor Locally, hence he can’t see outsides,
  • remove his character Mesh to all players with Net Multi Cast Event excluding self, hence others can’t see him.
  • once character leaves Collision, destroy box actor, set Character Mesh

I see. You could have a second camera(with the same transform as the player-camera) which does not render either of the boxes, rendering to a rendertarget. Youd project that render target onto the exterior box in it’s shader. This isnt a good solution though, it because it sortof double the rendering cost of the scene.