5
$\begingroup$

I'm trying to do a cutout animation with imported .png's. The only way I've found to get them to render faithfully is to make them either shadeless or emitters with an emit value of 1. However, I'd like to simulate the effect of actual cutouts where they sit on top of one another and cast a small drop shadow. I've tried adding a second lamp with the 'only shadow' shadow checked, which works to some extent, but the shadow is very faint no matter how much I increase the energy of the lamp.

Is there any way to achieve this effect?

$\endgroup$
7
$\begingroup$

Well you see, in reality, shadow is simply the absence of light. So to make something shadeless and receive shadows doesn't make any sense at all.

But of course, there is always a way around the laws of physics :)

There may be a few ways to do this, but the first that comes to mind is compositing:

render


Your "shadeless" material should just be a regular material with shadeless turned off.

Then you need to give a unique Object Index (or Material index) for the objects with shadeless materials - this will allow to do compositing for only those objects:

id

Then enable some render passes:

  • Shadow to give you... well, shadows.
  • Object Index so that you can isolate those shadeless objects.
  • Color so that you get the material color without any shading.

passes

So when you render, you'll get:

Plain uncomposited render:

raw

Shadow:

shadow

Object Index:

id

Color:

color

Then in the node editor, you simply need to multiply the Color and Shadow passes to get your shadeless but with a shadow effect:

shade

And then use the ID Mask node to isolate the objects that you want to be shadeless, and use that as the Fac to mix the raw render and the shadeless part together (so that only the objects that you want to be shadeless are shadeless):

nodes

render

Download the .blend


Note: If you get aliasing issues, enable Full Sample in the render settings.

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ Thank you for such a comprehensive answer. I'm very new to Blender so this looks quite intimidating (although the result looks like exactly what I'm looking for). If you don't mind, I'll see if there are any simpler solutions offered before accepting it as the answer. $\endgroup$ – magicalex Jul 28 '15 at 9:53
3
$\begingroup$

I like Greg's answer a lot. That said, if you want a method that doesn't involve compositing you can always use textured planes with transparency and give it nice even lighting with a Sun Lamp.

Final Result

Image planes with shadows

How-To

To get your textured planes in to Blender the easiest way is with the Import Images As Planes add-on, which is included with Blender so it's as easy as enabling in your Preferences.

Enabling the Add Images As Planes add-on

You can then add your cut-out images from the File Menu.

Add Images As Planes from the File Menu

The add-on includes some handy preset options. You'll want to check "Use Alpha" and select "Diffuse & Transparent". You can choose between Straight Alpha and Premultiplied Alpha.

Import options

Add a Sun Lamp, which is a type of lamp that lights from one direction evenly as if coming from a gigantic light source like the sun. The Sun Lamp's Strength determines how bright the lighting is, and its Size determines how soft or hard your shadows will be. The distance from one plane to the next is also a factor, as you can imagine.

Sun Lamp settings

Aim the Sun Lamp almost directly facing your image planes, with enough rotation to create a shadow in the direction you desire.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Another great answer. I'll give them both a try. Thank you. $\endgroup$ – magicalex Jul 28 '15 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.