Where to find a Matte Shader?

 

Hi Folks.

A Matte Shader is one of those rather basic 3D thingies I'm definitely missing in Axy.
(Or maybe I just haven't found it yet, hence the question :-))

What am I looking for?
Well... basically a transparent shader that cuts off all geometry that is *behind* the object the shader is applied to, while at the same time receiving shadows.
In this image the cube sits inside the rectangle, casting a show.
The rectangle naturally 'cuts off' the lower part of the cube.

When I apply a CUT.XSHAD in 'Add' mode to the rectangle, the cutting off happens as expected, but the shadow is gone:

I was hoping that applying a Cut_ShadowMask.xshad would bring the shadow back, but it doesn't.

I then tried various other shaders with the word 'shadow' in the name to no avail.
'Solid_ShadowOnly' almost cuts the mustard:

But it becomes transparent where there should be shadows and opaque where it should be transparent.

Matte/Shadow is such a basic thing that I'm somehow sure it is hidden in Axy somewhere.

If anybody could help to find that function I'd be very obliged.

Cheers & all the best.

Eric.



   EricWest

 
Profile Image
Eifert@Aximmetry
  -  

Hi,

You were quite close with the Solid_ShadowOnly shader.
You will need the [Common]:Shaders\Special\Transp_ShadowOnly.xshad shader, as it is described in the Augmented Reality's Adding Shadows paragraph:

Where to find a Matte Shader?

Also, set the shader's Transparency to Normal:
Where to find a Matte Shader?

Warmest regards,

 
Profile Image
EricWest
  -  

Hi @Eifert.

Thanks for the hint!
In fact, the shadow works, but there's no 'Cut Off' geometry:

Where to find a Matte Shader?

So I added a duplicate of the rectangle (slightly offset to avoid z-fighting) with a cut shader:

Where to find a Matte Shader?

Where to find a Matte Shader?

While this is okay-ish for simple geometry, it means a lot of extra GPU memory when instead of the rectangle there's an entire virtual Studio to mask out additional objects...

Cheers & have a great season!

Eric.


 
Profile Image
Eifert@Aximmetry
  -  

Hi,

I don't think we have a shader that does this. But you can easily modify the Transp_ShadowOnly shader to cut the geometry.
You can open the shader in the shader editor by right-clicking on it and choosing Open Import Source:
Where to find a Matte Shader?

In the shader editor, go to the Pixel compound and in it add a Blend State module and connect it to the Material Pixel Output:
Where to find a Matte Shader?

You should then save as the shader into a new file and connect it to your rectangle.

Note: The Blend State will change how the shader writes into different outputs of Camera, like the Transp Out and Mask video out pins, if you use these outputs, then you might want to change the Blend State module's parameters.

Warmest regards,

 
Profile Image
EricWest
  -  

Hey @Eifert.

Brilliant! Works like charme. Thanks so much!