### Prerequisites:

The following is a list of all prerequisites in order to make the most out of the following tutorial.
• Basic knowledge of how to use blender's compositor.

In this tutorial, we are going to learn how to implement a drop shadow and inner shadow effects in blender. Our implementation will be very easy and very similar to photoshop's one.

Sometime last year, I published this product and I think it is time you know how I created it.

I have this round rectangle from my previouse post and I want to drop some shadow from it.

By inverting the colors so that the interior of the shape is black and then bluring it, I get a simple ambient shadows. Then I add the original shape to the shadow to make the interior white again. (Because we can’t see the shadows that are directly under the shape)

By making a colored version of the shape and multiplying the shadow to it, I get some good looking flat icon.

Another type of shadow is the shadows where directional lights are presents, in this case, the shadow is more protruting to the outside in the direction away from the light. Lets implement that.

It turns out, if we just moved the shadow image, we could achieve a key shadow:

However, I want a better system to control the direction of the light or shadow. So lets describe the translation in terms of a polar angle and a norm. We are just changing how the user will input data, instead of inputting x, y values, we input an angle and an amount of translation in the direction of that angle. The conversion can be easily done by the following equation:

Where $\theta$ is the polar angle or the direction of the light and $\alpha$ is how much we translate by. (In physical world, $\alpha$ is the height of the light from the shape, think about it.)

One can use an Erode node to make the shadow more spread.

If you want to use both ambient and key, just multiply them. From all we learned, our final optimized node tree will be:

Where the size of the blur node is the blur radius, the two value nodes are the angle and magnitude of the light translation vector.