Artisticrender is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.  Learn more

Erik Selin
Erik Selin

3D artist & all that other stuff

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on reddit
Reddit

How to create a shadow catcher with Eevee in Blender

Let me break it to you: There is no shadow catcher for Eevee in Blender. However, we can fake a shadow catcher using the Shader to RGB node essentially making a shadowcatcher anyway.

How to create a shadow catcher with Eevee in Blender?

  • Add a plane below your object
  • Add a material to the plane
  • add a “Diffuse BSDF”, “Shader to RGB” and “color ramp”
  • connect the Diffuse to “Shader to RGB” to the color ramp and the color ramp to the alpha of the principled BSDF
  • In the material settings, change the Blend mode to “Alpha Blend”
  • In the render settings turn on transparent in the film section
  • Invert and bring down the blacks of the colorramp until your shadow catcher works.

We will outline this process a bit clearer below as well as building upon it by finalizing a scene in the compositor.

What is a shadow catcher and when do we use it?

Chances are that you already know what a shadow catcher is and in that case, move to the next section. But if you don’t, a shadow catcher is essentially a setup that allow us to render a shadow on a transparent background so that we may overlay it in another scene.

This is useful if we want to have a 3D object added on top of a photo. For instance, we may want to put a 3D car on a photographed road. In that case we need the car to blend with the photo in some way.

Matching the lighting of the 3D object and the scene is one thing and the other part is to ground our object by creating a believable shadow.

The shadow catcher takes care of the shadow part.

What do we need to think about when creating a shadow catcher?

As a short summary, we need to consider the following:

  • The light in the scene
  • Color of the shadow
  • Focal length and position of the camera
  • The environment, where would shadows be cast

First, we need to consider the photo we want to overlay our object on top of. For instance is the object put in a corner in a room or in an open space outdoors?

In any case we need to model the surfaces that the shadow is going to land on so that we may overlay them on top of the photo later.

In the case that we want to put something in a corner, we should model the corner and not just a flat ground plane for instance.

We also need to think about what camera and lens was used when the background photo was shot. This is because a camera has perspective and if we can’t line up the camera somewhat accurately the shadow won’t have the correct perspective and the shadows will be off.

How to set up the scene for a shadow catcher?

Let’s say that our object is already in the scene. Then we need to create an object to catch the shadow. This can be just a floor or a simpler mesh matching the background footage with walls and different layers.

Next we need the light source, I tend to use area lights quite a lot just because when you scale them up they give these nice soft shadows.

Then we need to set up the material. Note that the material we set up is for the object that will catch the shadow.

There are multiple ways we can set this up, but they all boil down to having a diffuse shader piped to a “shader to rgb” node and a colorramp. Here is an example.

This is the way I know of that uses the fewest nodes.

Keep in mind that we have a couple of other settings we need to change as well before we get a transparent background. First go to the material tab in the properties panel and in the settings section we can find the Blend mode. Set this to Alpha Blend. This will turn on transparency for the object so that everything that is not the shadow can actually be transparent.

Next we need to go to the render settings and into the film section. Here we find the transparent checkbox. Check it to enable transparency for the background as well.

We can also set up the shadow catcher with this setup. In this case we can control the shadow color in the bottom diffuse shader color slot.

If we want to be very exotic we can even use a texture as input for the color. In the example below I use a simple magic texture as input to get a whole range of colors. Perhaps not very realistic, but interesting if you want to go wild and feel creative.

We can do something similar in Cycles with shadows using the light path node. The light path node can also be used for a lot of other weird and sometimes useful setups. You can learn more about it here.

Related article: How the light path node works in Blender

There are some additional settings that we should take note of and sometimes change. In Eevees render settings find the shadow section. Make sure that soft Shadows is checked. This will create multiple overlapping hard shadows until the shadow becomes soft and get transparent edges.

The edge of the shadow is sometimes a bit jagged. This jaggedness can be minimized with the Cube and Cascade sizes. The Cascade size affect the sun light type and the Cube size if for all other light types.

The higher the value the more fine-grained the jaggedness of the shadows will be at the cost of performance.

High bit depth sometimes help fix glitches caused by the shadows but if you can get away without it leave it off because it is another performance cost to turn it on.

You may have noticed that as you use Soft shadows the shadow splatter around for some times then stop calculating. We can change the number of shadows that get thrown. In the sampling section find the render and viewport settings. Increase these to have a higher quality shadow. Again, at the cost of performance.

For simpler scenes you can go quite high. I tend to have 256 for both render and viewport.

Using shadow catcher in the compositor

To overlay the shadow catcher above our footage we can use the compositor. After you rendered your shadow catcher with F12, go to the Compositing workspace and press use nodes.

Drag-and-drop your background into the compositor node editor and press Shift+A and find the Alpha Over node. Connect the background to the top slot and the shadow catcher at the bottom.

Connect the alpha over to a composite and viewer node. The viewer node allow us to see the backdrop in the viewport.

To save this result, open an image editor. Chose the viewer node in the drop-down menu at the top and press Alt+S.

Final thoughts

This is how we can create a shadow catcher in Eevee. There is some more work involved and the result is not physically accurate. However, we get a lot of control, like being able to render a texture as the shadow.

If you found this useful please share it with others so that they may benefit.

Thanks for your time.

Get our free workflow cheatsheet!

Join our newsletter and get updates of our news and content as well as our 3D modelling workflow cheat sheet.

More to explore

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.