1
$\begingroup$

enter image description here

The shadowcatcher in this render has no control for how dark a shadow should be. Any help on adjusting it while maintaining the look of the scene? any help on the fresnel of the glossy surface would be helpful as well.

https://drive.google.com/drive/folders/18J1Y5wl_4TZzyyPOaJFRLE2rKOo9uWAA?usp=sharing

https://youtu.be/A8yM5Rf8MpA

$\endgroup$
3
  • 1
    $\begingroup$ Hello, maybe use the Compositor? $\endgroup$
    – moonboots
    Commented Mar 23 at 22:08
  • $\begingroup$ I love you moonboots. You have saved me many times in the past. Please be specific about shadows in the compositor. $\endgroup$ Commented Mar 23 at 22:11
  • 1
    $\begingroup$ Actually there may be a way through the Compositor but it may be easier in the Video Sequencer, you render 2 movies, one with the shadow alone, the other with the spider without the shadow (disable the spider camera ray visibility), and you overlay the 2 movies in the Video Sequencer? $\endgroup$
    – moonboots
    Commented Mar 23 at 23:15

1 Answer 1

2
$\begingroup$

It depends if you want to overlay some arbitrary background image with the shadow or - like in your question - have an HDRI environment which should be shown with the shadow upon it.

The latter is a bit more complicated as you need a second view layer to accomplish that, so I'll show you this method... and make it even more complicated by using a reflective sphere.

What I want to do: I place a metallic reflective sphere on a plane, the plane should be catching the shadow. The scene is lit by the HDRI background which should also be shown behind the sphere and the shadow as if the sphere was an object of the HDRI scene.

So here is how the scene looks before turning the plane into a Shadow Catcher:

basic setup

If you now turn the plane into a Shadow Catcher, you will immediately notice one problem: the bright plane is still visible in the reflection, although the ground should be the paving stones:

wrong reflection

You could disable the Ray Visibility for Diffuse and Glossy on the plane, but this would also remove the reflection of a shadowed floor on the sphere. Instead, you can give the plane a special shader: plug an Environment Texture with the HDRI background into a Diffuse BSDF, and to align it with the background, take a Geometry node, plug the Incoming output into a Vector Math node set to Scale by -1.

This is enough for the correct orientation right now, I also added a Vector Rotate node afterwards because if I want to rotate the world background along the Z axis, I can enter the same value in the Vector Rotate node to keep the plane shader aligned. This goes into the Vector input of the texture node. What I also added to the texture node is an RGB Curves node, to take down the overall brightness and also reduce the Blue channel a bit to match the plane color with the background (because theoretically the image is already showing a floor illuminated by the sky and gets now illuminated again from the sky):

changing the floor texture

And now the plane is ready to be set as a Shadow Catcher. But as you already know, if I would render it like this with the background enabled, I would have no control over the shadow separately. To get this control, I have to 1.) separate the shadows from the background by enabling Film > Transparent in the Render Properties and 2.) separate the shadows from the sphere, which is achieved by enabling Passes > Light > Other > Shadow Catcher in the View Layer Properties. And while I'm already there I also enable Environment because I need it as well:

setting the render passes

If I now render the scene, at first you'll notice no shadow seems to be rendered - it will only be found in the Compositor. Going into the Compositor, I have my sphere in the Image output separated from shadows and background which is good:

sphere image pass

I also have a separate Shadow Catcher pass which I can adjust with an RGB Curves node (why this instead of a simple Color Ramp for example I'll explain as an additional note at the end) and multiply it with the background, to create a shadow on it:

shadow pass

But now comes the disappointing part, the environment pass Env is showing black not only where the sphere is, but also the plane. Because even though the plane is not visible in the render, it works a but like a holdout object (actually a Shadow Catcher works exactly like a Holdout only that it additionally shows a shadow):

environment holdout

And that is the reason why I need a second view layer to be rendered. So I go to the top of the Outliner and click on the copy button next to the view layer's name and simply choose New. Now everything is in there. In my case everything is in a single collection, so I just disable all in this view layer:

new view layer

After rendering again and adding a second Render Layers node in the Compositor, I switch it to the new view layer and have an empty transparent scene there which gives me the complete background in the Env pass:

empty background

Now I can mix this all together in the following order: the Env pass of the second layer goes into the first color input of a Mix Color node set to Multiply. The second input is the Shadow Catcher pass from the first layer. Then over this result I put the sphere from the first layer Image by using an Alpha Over node and I now have my basic image:

shadow composited in

Okay, but that's what I would have gotten if I simply did not make the background transparent. So, for adjustments, first of all you could of course simply brighten the shadow overall by reducing the Fac value on the Mix Color node. But to darken the shadow or change the interpolation, you can plug the Shadow pass into an RGB Curves node and play with the settings. The only issue with this is, the reflection in the sphere will not change with this but if the adjustment of the shadow is not too extreme this might not be too noticeable.

adjusted shadow

Now finally, why use an RGB Curves node instead of a simple Color Ramp? There is a major difference in how the Shadow Catcher behaves between using it directly with the render or separately as a pass in the Compositor.

To show the difference I use a much simpler setup: a white sphere on a white floor. Lit by a bright sunlight, throwing a sharp shadow. But the shadow is mostly blue, because those areas where the shadow is are brightened by a blue sky overhead:

colored shadow

If I now set the plane to be a Shadow Catcher and render it simple, without a separate pass for the shadows but directly in the scene, the following happens if I use an Alpha Over node to put this image over a white background (not really white due to Color Management, but anyway): the shadow beneath the sphere is grey, not blue - because the shadow catcher only shows the information how much the brightness level changes on average. This might look strange when the shadow side of the sphere has a blue tint:

greyscale shadow

However, if you use a separate Shadow Catcher pass and combine it in the Compositor by multiplying a background color (or image) with it before overlaying with the sphere, the pass provides the brightness information per RGB channel, which makes it possible to have colored shadows - and it is not only darkening the background, but you can see to the right, it also brightens the background where the light reflected from the white sphere hits the floor (of course the floor would have a blue tint from the sky as well, but I'm just using some arbitrary color as background and white shows the effect best:

colored shadow with separate pass

And that is the reason why I would use an RGB Curves node instead of a Color Ramp, because otherwise the color information would be converted to greyscale. But even if you want to eliminate the color influence, you might want to have the influence of the sphere onto the floor, so using a separate Shadow Catcher pass will be useful in this case, too (in combination with an RGB to BW node).

$\endgroup$

You must log in to answer this question.

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