2
$\begingroup$

I'm compositing a 3D plant over a picture of a street, inspired by a tutorial from a guy creating really good ones. I want the plant to receive the shadows from the buildings and cast its own shadow onto the street.

I didn't find a shadow catcher option in Eevee so I'm rendering with Cycles. Lighting consists only in a 360° image for the World background, oriented to match the shadows of the background image (settings). The background image is used as camera background for preview and also used as input in the compositor (settings).

To create building shadows on the plant I've a silhouette with a material invisible to the camera but able to cast shadows (material). To receive the plant shadow on the walls and ground I have a shadow catcher (settings). Unfortunately it also receives the silhouette shadow (shaping the shadow catcher to exclude the silhouette is likely not possible since the shadow limit is not clean).

This works as anticipated, except the shadows from the shadow catcher don't blend correctly:

enter image description here

Closer view:

enter image description here

The two aspects which are not satisfactory are the darkness of the shadows, but also the difference in blurring, my shadows are way too clean.

I'm using Blender 3.1. I know only the basics for render engine and compositor. I read this answer valid for 2.8, but I don't see a Shadow Pass in 3.1.

Any suggestion for blending correctly the shadows into the background picture (luminance and blurring)?

Simplified file:

$\endgroup$
6
  • $\begingroup$ If it's just a standstill image, you can probably get away with making 2 different shadow catcher "captures" (I don't want to confuse the word "pass", although I would normally use it), save them as image textures (with alpha) and then add (multiply) them together in the compositor using a mix node. $\endgroup$ Commented Apr 26, 2022 at 17:29
  • $\begingroup$ @ChristopherBennett: To catch the building shadow on the plant I would need to turn a copy of the plant into a shadow catcher, right? $\endgroup$
    – mins
    Commented Apr 26, 2022 at 20:19
  • $\begingroup$ Yes. That should work. One scene with building silhouette blocking light and plant as shadow catcher, and another scene with plant blocking light and ground as shadow catcher. $\endgroup$ Commented Apr 26, 2022 at 20:24
  • $\begingroup$ @ChristopherBennett: Thanks. I did that using view layers as suggested by Adisage in their answer (except I still need to extract an adjustable building shadow using the plant as a catcher). The result is this one. As I mentioned to Adisage, light is not blocked by the buildings silhouette creating a wrong shadow on the street (should not exist in the building shadow). I believe limiting the catcher to the area in the sun only is not possible (buildings shadow terminator is blurry). Any idea? $\endgroup$
    – mins
    Commented Apr 26, 2022 at 20:38
  • $\begingroup$ I'm not really sure how to advise further without knowing more about your project/setup - consider uploading your .blend file (or a "simplified" version that highlights the problem) here - blend-exchange.com - so users here can get a better "feel" for what you're working with. $\endgroup$ Commented Apr 26, 2022 at 20:47

1 Answer 1

1
$\begingroup$

Ever tried using the Render Layers? It's a very powerful tool that can help you get the most out of compositing... I will highly recommend checking out some good videos on YouTube to understand how it works.

For your purpose, try this :

  • Group your plant mesh in one collection
  • Keep your shadow catcher in a seperate collection
  • Keep your building shadow casting objects in another collection
  • Create two render layers, one for Plant and one for Shadow Catcher, and set it up as follows :

Plant Render Layer

Shadow Catcher Render Layer

  • Then merge the two render layers in compositor using the Alpha Over node :

Compositor Node Setup

Since the shadow is separated from the plant, you can now change its brightness, color and blur in the compositor itself. However, I would still suggest you use an HDRI in the world background which matches closely to your background image... or use a cloud image in the World settings, and use a Sun light to get the desired shadow effect.

Hope this helps !

$\endgroup$
3
  • 1
    $\begingroup$ Thanks for pointing to the view layers (I need to learn about them). I tweaked a bit your solution, to get a layer for the plant shadow on the street alone which I can adjust (catcher layer) and one for the plant with the building shadow on it. It's better but there are still two problems: 1/ the plant shadow is cast even where there is already the building shadow and 2/ I cannot adjust the building shadow on the plant since it is not independent. A snapshot. $\endgroup$
    – mins
    Commented Apr 26, 2022 at 20:13
  • $\begingroup$ 1/ the plant shadow is cast even where there is already the building shadow :- Since the shadow is on a separate layer, you can simply mask it out using the Blender mask or in an external photo editing software like Photoshop. || Alternatively, you can edit the shape of the shadow catcher so it won't spill over the other shadow area. $\endgroup$
    – Adisage
    Commented Apr 28, 2022 at 18:21
  • $\begingroup$ 2/ I cannot adjust the building shadow on the plant since it is not independent :- That's the reason I suggested you try using other HDRIs, or add more lights to your scene. Alternatively, you can try using the EasyHDRI plugin for Blender. It is free to download, and it will give you a lot more control over your the light intensity cast by the HDRI. Or else, you can make your building shadow objects a bit more transparent in the shader. $\endgroup$
    – Adisage
    Commented Apr 28, 2022 at 18:24

You must log in to answer this question.

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