Build a Better Shadow Pass – Blender Cycles (Transparent Shadows)

Hey guys! Today’s tutorial is about how render Transparent Shadows in Blender Cycles. I have seen multiple tutorials explaining this, and most of them work, but they sometimes do not work properly or are lacking important features. If you didn’t know, Blender Internal can render Transparent Shadows too (Check out my tutorial on it HERE! 😀 ) (but it’s much easier than Cycles. 😉 ) The reason I made my own Node Setup for rendering Transparent Shadows in Cycles is because I watched Blender Tutor’s How to Render a Shadow Pass in Cycles” tutorial. Well, that didn’t work for my scene, because he used a “linear mask”, and I could not get it to work with my scene because mine was a lot more complicated than his scene. So, I launched Blender and started playing with Nodes.

Let’s get started!

Scene Setup

First, you’ll need to open Blender and set your render engine to Cycles.Renderers

For this tutorial, I’m going to use Suzanne the Monkey as my example model. First, I added it (Add>Mesh>Monkey), deleted the default point lamp, created a sun lamp, and moved my camera.

NOTEWORTHY: Any kind of light source will work for this tutorial. Mesh Lamps, Generate Lamps (like Sun, Point, etc.), or any other light source will work. If a shadow is cast, this node setup will render it.

For the monkey to cast a shadow, I need to add a Plane under the model for it to cast a shadow on. Adding a Material on this plane is not necessary, but you can add it if you want.

shadow1Then, I’ll move the plane to Layer 2. To do that, select it, press ‘M’ and then click the layer you want (or press 2 on your keyboard). Once that box has gone away, show layer 2 in the viewport by holding Shift and clicking Layer 2. (This will show layers 1 and two). layer 2

Render Layers

I will need to go to the Render Layer Settings layers . On the render layer that contains the monkey, find the Mask Layers section and select the second layer in it. This will tell Cycles not to render the plane, but will still let it cast a shadow on it (if you understand that 😛 )

mask layer 1

Now, we need to create a new Render Layer. This Render Layer will contain the plane for the shadows. Let’s name that Render Layer “Shadow”. There are many things we need to do in this layer. First, we need to tell this Render Layer what layer in our scene to render. Under the “Layer” header, select only the second layer (the layer with the base plane). Then, we need to tell Blender which passes to render on this Render Layer. Under the Passes header, make sure “Combined” and “Shadow” are selected.

render layer Shadows

Node Setup

Now for the Nodes (this is the fun part 😉 ). First, you need to go the the Node Editor. The easiest way is to go to the top pane, and use the interface changer.

Compositing LayoutOnce there, make sure you are in the Compositing Nodes area, and not the Material or Texture Node area. The button is on the bar right below the Node Editor window and it’s icon looks like this:

Compositing Nodesonce there, make sure you check “Use Nodes”. You will need 2 Render Layer Nodes. One for the main part of the scene to render (which will probably be called “Render Layer“), and the other for the shadow plane (which we named “Shadow“). We will also need a Mix node (which we changed to Multiply), Set Alpha node, Invert node, Alpha Over, and of course the Composite node.

I cannot explain exactly what every node I use in this setup does (it takes a bit of time and it would probably be difficult to explain in writing), so I have provided a picture of the node setup below.

Shadow Pass Node Setup

Make sure that you follow this node setup exactly, because if the colors in the Multiply and Set Alpha nodes are not exactly white, the Shadow Pass will not work correctly.

Final Result

This is the final result obviously, it’s not the same model I used in the tutorial. I lost that model I used at the beginning, and I think you’d like to see something other than a monkey head for once. 😉

Carrot Render

 BONUS TIP

If you want a softer shadow look, or have Ambient Occlusion on, you can use the “AO” pass instead of (or along with) the Shadow pass. All you have to do is select AO in the render layers and connect it in the Node Setup where the Shadow would be. If you want to mix the AO and the Shadow passes, just plug the Shadow pass and the AO pass into a a Mix Node (set to Multiply) then plug it into the other mix node (set to multiply). (See picture below)

Bonus Tip

Closing Notes

There are a few issues with this Node Setup, but they are unable to be fixed because of the way Cycles renders shadows. On the edges of the Shadow plane, there is a small outline due to the fact the the plane has a shadow on it’s edge somehow (like I said, it’s the way Cycles renders shadows). The only way to fix this is to make sure the edges of your shadow plane do not show in the render (by scaling it so large that the edges are not seen in the camera). And that doesn’t always work either.

I hope this tutorial helps with Cycles! It helped me a lot with my renders. 🙂

Happy Blending!

-rioforce

Advertisements

7 thoughts on “Build a Better Shadow Pass – Blender Cycles (Transparent Shadows)

  1. Hi
    I’m trying to use this tutorial with a UV Sphere as a light emitter but this don’t work. When I change it to a Lamp then everything is ok.

    Could you help me?
    Thx for the tutorial:) it’s great:)

      • Thx for the fast answer:)

        I know that this isn’t your job but could you create a tutorial how to make a light that will good imitate a real light(like a mash light)

        PS. In which Blender version did that work?

      • I’m pretty sure it worked in Blender 2.69, but I don’t have it installed anymore, so I can’t test it out. As for another tutorial, I’m afraid I can’t help you on that one. I recommend that you just experiment and see what you can figure out. 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s