StaticMesh visible only through material.

Hello all,
I want to have my static mesh show only through a material.
I got the idea that I will need to use depth buffer / custom stencil, and I feel that it should be straightforward … but I can’t find any good resources.

In my mind it should go like :
I make a mask in screen space from the plane, I use the mask to show/hide the static mesh.
I don’t even know where to start in UE4 to implement that effect.

Those anyone has any ideas ?!

  1. Assign an DepthStencil ID to the Plane Mesh via it´s properties.
  2. Then, Create a new material for the "A"and set it to Translucent.
  3. Then you connect the following to your materials Opacity Output:

258512-stencilmask.png

  1. Choose the Stencil Value of your plane as the Value for the “Bit” input.
  2. Place the plane and the A next to each other and assign the material to the A. It will now be invisible unless the plane is behind it.

Works well indeed.
However, the material loose the shading and look flat.

Thanks you anyway, was a clear answer.