Unable to render matte object shadows on transparent background

To get transparent background I’ve disabled primary ray in dome light settings which makes the background transparent but also makes the shadows on the matte object disappear. If the primary ray is enabled on the dome light only, then the matte object generates the shadows, but the background isn’t transparent anymore.

Thanks for posting this. Yes, mat shapes need to give choices on how they work. They could be reflective, cut out, or used for shadows.

Yeah, they do create shadows etc. but only if you have environment texture in the background. And if you make it transparent then the shadow disappears which means you can’t composite that render in any image or video. I thought maybe I just don’t know how to do it, but now it seems like its not possible.

You need to then add another background or background color with the Post Processing > XR Compositing Option. Change the RGB Value from default black, where no shadows are visible to a red, for example, where you can now see the shadows.

Problem number 1: For a white cube and shadow putting the red background is cool. Then you can remove the red channel and add anything in background. But if the scene is complicated with lots of objects of different colors then this method won’t work. As removing red channel would effect skin tone of characters and other objects. So there is no way to do a transparent background export?
Problem number 2: I’ve added just a cube and a distant light in scene.


and it still black in background

The xr compositing is enabled and have set the color to red, and its still the same


Can you tell me what other settings have you changed in order for it to work?

And did you turn off “Visible in Primary Ray” for the light ?
NOTE: The XR Composition post process only shows up in the REALTIME mode and not currently the Path Tracing mode. It is a known bug we are fixing.

For rendering, things are easier because you can rendering out a PNG sequence with Alpha Transparency on, and you should just get the cube and the shadow on a transparent background. You do NOT need XR comp for that. This is just for seeing the results live in the viewport.

The visible in primary ray is disabled. I’m using the REALTIME mode. And the xr compositing doesn’t change colour in view port when changing the colour value in side panel like you’ve shown. Plus you’re using the version 2023.2.0 while the latest version available for me is 2023.1.1.

And the render image does show shadow but its different for each light. The dome light isn’t rendering any shadows at all. The distant light renders shadows with a white line surrounding it.

The cylinder light renders milky white shadow with some dark shadow as well, and that milky white is not reflection because I applied the omnipbr material and then set matte just like it was advised in the video.

Just to be clear, you do not need to use XR composition, to output a cube and its shadow on a transparent background. XR comp is only to show a difference live in viewport.

If you want to still use XR comp, in the current released version the RGB background color picker seems broken. So now try to add a real background texture to the texture slot and that should work.

Here is the same thing in 2023.1.1