How to create a invisible material that masks meshes that are behind it

Hello im looking to create a material that when applied to a mesh it makes it transparent/invisible but also blocks the camera from seeing/rendering things behind the mesh…so if cube has the material and there is a cylinder behind the cube you cant see the cylinder or it would look like there would be a cube shape masked out of the cylinder (if the cube is smaller than the cylinder)

kind of like the screen shot attached

Thanks!

1 Like

like this?

the test I did is a bit tricky…I can share if you want

1 Like

Add a scene capture actor attached to the main camera:

Create a render target texture the size of the screen:

image

Disable motion blur and dont use temporal anti aliasing

add some tag to the actors you want to be invisible like ‘ignore’

then add those tagged actors to your capture ignore list like this:

image

create a material (unlit) with the captured render canvas as color)

I think thats all…just in case this is the blueprint of the map

THIS HAS A LOT OF LIMITATIONS AND IS NOT CHEAP> I AM SURE THERE IS A BETTER APPROACH.

Cya

1 Like

awesome!..thanks for the documentation ill give this a try!!

1 Like

Ok gave this a go and I dont think its going to work but im not the most experienced…im building off of the AR template…so I cant have actors in the scene to start and im not knowledgeable enough to tweak the BP you created to test if it will even work

here is another thread that could be helpful

https://www.reddit.com/r/unrealengine/comments/zq3snm/mesh_material_hides_specific_objects_behind_it/

also:

ok so build this one out and works as advertised…as soon as I swapped the cube for a different static mesh that was less cube like…lets say an airplane shape for example it wont work…in the vid they use a cube mask in the bp.…ive experimented with the sphere mask as well….still not working

thanks for the help, really appreciated it…learning alot

Hey, have you solved this yet? i’ve tried all aproaches i could find but nothing was 100% mesh based, Custom depth stencil method depends on camera angle, Nearest DF has many issues, Box mask will always be a box (obviously)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.