blocking another material/mesh showing by masking from another materials opacity

this is a weird question but say if you had a plane above another plane, each with a material applied and each being having some opacity e.g. noise as opacity mask, and below the 2 planes you have your game, imagine the camera is above all the planes and the game (top down) can you set the uppermost plane to only allow the game meshes to show through its opacity channel but not the mesh below to show ?

if you don’t understand me i am willing to draw a picture, sorry

thanks

Hey bennetherwood -

Yes, it should be possible, but as picture of exactly what setup you are looking for would help. This might be using a lot of material functions and a Material Parameter Group.

Eric Ketchum

thanks so much ! i think this describes my situation

imagine the below (blue and red) are just a plane with a material applied with their colors and a opacity mask with
shapes

you can see the blue material doesnt show through the red even though it is directly below the red and you just see the world.

i was thinking, could i use custom channels in project setting?

I don’t get it, wouldn’t this mean that the blue plane is always invisible? Or is the red plane smaller? Or is it multiplayer and see different players different planes? Because this would change the strategy a lot on how to set it up.

I don’t know of a setup inside the editor to make it possible the way you draw it. But it is possible outside of the editor. My knowledge of the unreal shader code is zero at this poinnt, so can’t really send you a solution. But here is the basic idea of how I would solve it:

You make the red plane render in 2 passes, 1 that does not write to the depth buffer, but draws the holes and color. Another pass that ONLY writes to the depth buffer, the complete plane, so no holes or anything. This means that if the blue planes is rendered later, it won’t actually render anything behind the red plane, since we already told the depth buffer that there is something there.

The blue plane can just be rendered regularly, except for the fact that you need to make sure the GPU is aware that is is rendered later than the red plane. In Unity this was called RenderQueue, not sure what this would be in Unreal.

The blue plane is invisible when viewed under the red mesh only, I know this is a tall order, and I don’t understand shaders at all, was hoping Blueprints could help :frowning:

I’ll try and have a tinker

Hey bennetherwood -

You will have to use some post processing effects and a custom render depth pass. I am still working on your issue but have encountered an unrelated issue with Custom depth rendering that we are tracking down.

Thank You

Eric Ketchum

Alright thanks man !

Hey Bennetherwood -

I know it has been a while but I haven’t forgotten you. This can actually be accomplished with a little bit of Blueprint and a custom depth material setup. I will say to begin that there are some limitations currently, since we want to use Custom Depth and Transparency you will need 2 planes for each plane layer, one that functions as a custom depth test and the other that will have the transparency material. This will also not effect lighting, i.e in the final effect look at the shadows of the two planes as the one moves.

Here is the Material Setup:

In the BP you will have a plane which is assigned the above material with the following rendering setup:

The next Plane can have the default World Material assigned by the Custom Depth needs to be turned on in the Rendering section like this:

The only difference between the Red and Blue Planes is position (one in front of the other) and Base Color and Opacity setting which I controlled through a Material Instance but does not effect the Technic. The Material and Custom Depth Settings are the same for each it is the position from the camera to the rear that determines the effect.

Final Effect:

25733-finaloverlappingefx.gif

Thank You

Eric Ketchum

Thank you so much, I figured out a more costly way however yours is better so thank you so much !