0
$\begingroup$

I have a preloaded scene which is causing me some grief.

I need to achieve a single PNG output render, which contains the object rendered, and the shadows cast, but NO BACKGROUND (transparent background PNG) and it needs to be in Blender 3.2 using cycles.

So, I have done the following three basic steps;

  1. Stage (aka ground plane) = object settings -> shadow catcher
  2. Render properties -> film -> transparent.
  3. Output -> output -> file format = PNG, Colour = RGBA. In fresh blends, and in newer versions of blender, these settings output a render with a transparent background. However in this file, there is some setting, maybe in the compositor, which is causing a completely white background on the shadow catcher, which means my png renders are not coming out with a transparent background...

Can anybody spot the issue with this file and let me know how to correct it? I've packed the blend and will attach the blend exchange link now Thank you

example render output combined but no shadow shadow catcher layer has solid white background enter image description here compositing nodes

Blend File:

$\endgroup$
0

2 Answers 2

4
$\begingroup$

The Shadow Catcher is foremost meant to be composited over backgrounds by multiplying the colors with the shadows and by this darkening the existing colors.

The transparent part of an image holds no color information (i.e. it is black), so darkening it would not work. Also multiplying solid white without any alpha will not get you a transparent background as you already discovered.

So in order to get it to work you have to do a workaround: you take an Alpha Over node with a transparent white in the first color socket (i.e. a white where you set the Alpha value to 0) and an opaque white as the second color. Use the Shadow Catcher pass as the factor.

After the Alpha Over node you plug a Invert Color node where you enable RGB and Alpha. Now you have a shadow on a transparent background.

If the shadow is not dark enough, you can use an RGB Curves node before the Alpha Over node to increase the contrast.

convert shadow catcher to transparent shadow

The only downside to this is, when using the Shadow Catcher object directly the shadow is always greyscale, in the Compositor using the pass it can be colored - but with this method you only get greyscale shadows as well or at least coloring does not work so well.

$\endgroup$
1
  • $\begingroup$ thanks so much for this answer, so far this looks like the way to go. I'm achieving the output exactly as required. Appreciate the note on the shadow colour as well, and thankfully greyscale shadows are all that is required. I'll try implementing it through the rest of the pipeline asap. $\endgroup$
    – ScottF
    Feb 27 at 10:18
2
$\begingroup$

In the Outliner, go to View Layers tab, click on this button to create a duplicate, name one of them Main, the other Shadow.

In the restrictions toggle menu, enable the Indirect only function.

enter image description here

Put the object into one collection (Objects) and the shadow catcher into another (Shadows).

In the Main view layer enable "Indirect Only" for the shadow collection. In the shadow view layer enable "Indirect Only" for the Objects collection.

In the compositor duplicate the Render layer node, set one to Shadows and the other to Main, then plug them into an Alpha Over node.

enter image description here

$\endgroup$
1
  • $\begingroup$ I may trial this method in the future, but at the moment the answer from Gordon above is achieving the desired output as a single layer. I think your option may be better if coloured shadows are ever required, so I definitely appreciate seeing this method demonstrated. Thank you so much. $\endgroup$
    – ScottF
    Feb 27 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .