Sub topic 9
Softening shadows as they move away from the subject
A shadow with one uniform edge looks pasted on. In real light, a shadow is sharp where the object touches the ground and gets softer and fainter as it moves away. This chapter shows how to reproduce that falloff with Gaussian Blur, a gradient mask, and a few supporting techniques.
This chapter assumes you can work with layers, layer masks and blend modes, and that you have already built a contact shadow and a cast shadow on separate layers. If you haven't, finish those chapters first.
Why shadows soften with distance
A shadow's edge is soft because the light source has size. A point source gives a razor-sharp edge. A large source, such as an overcast sky, a window or a softbox, lights the ground from many angles at once. Near the object, almost all of those angles are blocked in the same place, so the shadow is dark and crisp. Farther away, the blocked regions from different parts of the light drift apart, and the edge turns into a gradual transition called the penumbra.
Two practical rules follow from this:
- The shadow is sharpest and darkest where the object touches the surface.
- Both sharpness and density fall off with distance from the contact point. The larger the light source relative to the object, the faster this happens.
A single blur applied to the whole shadow layer cannot do this. It makes the contact point as fuzzy as the tip. The goal is a variable blur: little or none at the base, more at the far end.
Choosing the blur amount
Start with a uniform blur to get the overall softness right, then add the variable part.
Use Filter > Blur > Gaussian Blur. The radius is in pixels, so the right value depends on image resolution. A radius that looks right on a 1000 px wide image will be almost invisible on a 6000 px image. As a starting point, use a radius of roughly 0.3% to 1% of the image width for the far end of the shadow.
| Lighting in the photo | Light source | Starting blur (on a 3000 px wide image) |
|---|---|---|
| Direct midday sun | Small, distant | 3 to 8 px |
| Light cloud, open shade | Medium | 15 to 30 px |
| Overcast sky, large window | Very large | 40 to 80 px |
Treat these as starting values. Compare your shadow with other shadows already in the photo, such as a fence post or a tree trunk, and match their softness.
Blur as a Smart Filter
Before you blur, convert the shadow layer to a Smart Object (Layer > Smart Objects > Convert to Smart Object). The blur then becomes a Smart Filter that you can reopen by double-clicking it. You can change the radius later without re-making the shadow. It also comes with its own filter mask, which is useful in the next section.
Building the variable blur with a gradient mask
The most reliable method uses two copies of the shadow. One is sharp and one is blurred. A gradient mask blends from the sharp copy near the subject to the blurred copy far away.
- Duplicate the shadow layer. Name the lower one
Shadow sharpand the upper oneShadow soft. - Blur
Shadow softwith Gaussian Blur at the far-end radius from the table above. - Optionally apply a very small blur (1 to 3 px) to
Shadow sharpso the edge isn't aliased. - Add a layer mask to
Shadow soft. - Select the Gradient tool, choose the Foreground to Background preset, and set the mode to Linear.
- With the mask selected, press
Dto reset to black and white. The mask thumbnail must have the white-edged highlight showing, or you will paint on the pixels instead. - Drag the gradient along the direction of the shadow. Start at the contact point and end at the shadow's tip. Where the mask is black, the sharp copy shows. Where it is white, the soft copy shows.
Reverse the gradient with X if the soft copy appears at the base rather than the tip.
Fading density at the same time
Softness is only half the effect. The shadow should also lose density with distance. Add a second gradient to the mask of the Shadow sharp layer, running from white at the contact point to a mid-gray or black at the tip. Because both layers use Multiply, their combined darkness is the sum of both, so you may need to lower the opacity of each. Check the result at 100% zoom, not only zoomed out.
A common pattern is:
Shadow sharp: Multiply, 70% opacity, mask fades to black by about 60% of the shadow length.Shadow soft: Multiply, 55% opacity, mask fades in from black at the contact point.
Alternative: the Blur Gallery and Smart Filter masks
If you want a single layer, use a Smart Filter mask instead of two copies.
- Convert the shadow layer to a Smart Object.
- Apply Filter > Blur > Gaussian Blur with the far-end radius.
- Click the Smart Filter mask thumbnail (the white box next to the filter name).
- Drag a black-to-white gradient from the contact point to the tip.
Where the filter mask is black, the blur is hidden. Where it is white, the blur is fully applied. Values in between give partial blur strength. This is not a true variable-radius blur. It cross-fades between the unblurred and blurred versions, so the middle of the shadow can look like two overlapping edges. For short shadows this is invisible. For long ones, use several copies with increasing radii, or try Filter > Blur Gallery > Tilt-Shift, whose blur strength changes along a line.
Gradient direction for a cast shadow
The gradient must follow the shadow, not the canvas. A shadow that runs diagonally into the background needs a diagonal gradient. Hold Shift while dragging to snap the gradient to 45-degree steps, or drag freehand to match any angle. After applying it, hide the other layers and check that the transition runs along the shadow's length and not across it.
If the shadow was built with Transform, Distort or Perspective, make sure the mask is not linked to the layer in a way that warps it. Click the chain icon between the layer and the mask thumbnails to unlink them when you need to move or transform the mask separately.
Soft shadows on contact versus cast
Do not blur the contact shadow the same way as the cast shadow. Keep the contact shadow tight, usually 1 to 6 px of blur, and darker. It represents ambient occlusion, which is the small area where the surface is almost completely hidden from the light. Soften only the cast shadow with distance. If the contact shadow vanishes inside the blur, the object appears to float.
Scripting the blur
You can automate the soft step with ExtendScript. This example blurs the layer named Shadow and sets Multiply and opacity, as in the earlier example. It does not create the gradient mask, which still needs a manual drag.
// Assumes a pixel layer named "Shadow" already exists in the document
var doc = app.activeDocument;
var shadow = doc.artLayers.getByName("Shadow");
shadow.blendMode = BlendMode.MULTIPLY;
shadow.opacity = 55;
shadow.applyGaussianBlur(12);Note that applyGaussianBlur works on pixel layers. It is not available on Smart Objects. If you converted the layer first, run the script before converting.
Common errors
- Blur eats the edges. If the shadow touches the layer's pixel boundary, the blur is clipped and creates a hard line. Add transparent padding first, or make the canvas larger and crop later.
- Gray halos. If the shadow layer is not set to Multiply, a blurred black shape shows as a gray cloud. Set Multiply and check again.
- Resolution mismatch. Blur radius that looks right at 50% zoom may be too weak or too strong at 100%. Judge softness at 100%.
- Mask applied to pixels. If you painted a gradient onto the layer instead of the mask, the shadow is permanently altered. Undo, select the mask thumbnail, and repeat.
- Uniform opacity. A shadow that blurs but does not fade still looks flat. Always combine softness with falling density.
Summary of the workflow
- Match the overall softness to the light in the photo.
- Duplicate the shadow into a sharp copy and a blurred copy.
- Mask the blurred copy so it appears only away from the subject.
- Fade density along the same direction.
- Keep the contact shadow separate and tight.
- Check at 100% zoom.
Exercise
You blur a whole cast shadow with a 40 px Gaussian Blur, and now the subject looks like it is floating above the ground. What is the cause, and how do you fix it using a mask?
Show answer
A uniform blur also softens the area at the contact point, where the shadow should be darkest and sharpest. Undo the blur on that area by duplicating the shadow, keeping one copy sharp (or lightly blurred), and adding a gradient layer mask to the blurred copy. The mask should be black at the contact point and white at the shadow's tip, so the blur appears only with distance. Keep a separate tight contact shadow as well.
Exercise
A shadow is fully blurred by a Smart Filter mask gradient, but the middle of the shadow shows a faint double edge. Why does this happen, and what can you do?
Show answer
A Smart Filter mask cross-fades between the unblurred and blurred versions of the layer, so partway along the gradient you see both edges at partial strength. It is not a true variable-radius blur. Use several copies with increasing blur radii, each masked into its own section of the shadow, or use the Tilt-Shift blur in the Blur Gallery, which varies blur strength along a line.