Last version of Blender 2.79 comes with Shadow Catcher feature. Let’s check how it works along with HDRI lighting and backplate image used for background.
You can download complete tutorial project file from here
Preparing test scene
1. Remove default scene and create UV sphere. Go to tab Tools and choose Smooth.
Press N key and zero its location.
2. Choose Cycles Render engine. Apply material, Go to Surface > Use Nodes and choose Glass.
Open Node editor.
HDRI environment setup
1. Remove Lamp from outliner
2. Switch to World and press Surface > Use Nodes.
3. In Node editor click World icon
4. Press shift A. Textures > Environment Texture. Connect new node to Background Node.
5. Load HDRI image. Go to Render tab switch to GPU device if your maschine is equpped with descent GPU card. Change Viewport shading to Rendered.
6. Let’s add mapping controller. Shift A Vector > Mapping
7. It doesn’t work properly so we need to add another Node: Shift A Input > Texture Coordinate. Connect Generated to Vector and it’s done. Use Location Y for closer or distant look, and Rotate Z for rotation. You can control brightness of your environment with Background Strength value.
1. Unfortunately in our test scene shadows are not visible. We need some kind of surface to bounce light coming from HDRI environment.
2. Create > Plane and match it position to Sphere created before. Scale it up. (Num 7 for Top view. Num 1 for Front View. User Perspective Num 5. Key A for deselect.)
3. Select new object and in Cycles Settings please check Shadow Catcher
4. Back to Rendered Viewport, there is a problem with transperency channel so we need to fix it.
Select Shadow Catcher and in Cycles Settings uncheck Transmission.
1. Sometimes we want to use some quality pictures as a background. We need to set them visible only to the camera.
2. Switch to Solid Viewport Shading. Ctrl+N and Background Images > Add Image.
3. Check what Camera and lens were used to take a picture. This backplate was taken with Nikon D800 and 35mm lens. We need to apply these settings to Blender camera too.
Select Camera, Focal Length: 35mm, Camera > Full Frame 35mm Camera, in Render Tab Dimensions need to match image size: 2400 x 1600px
4. Choose 10-35mm jpeg image. Lock Camera and position your scene so it fits the image
5. Switch back to Rendered Viewport and in Node editor rotate HDRI to match backplate more or less. Your backplate is not visible in a rendered scene. We need to fix it.
6. In render, settings make sure that Film > Transparent is checked on.
7. In Node Editor click on Compositing icon, and check Use Nodes
8. Add Input > Image node, open same background image. Next, add Alpha Over, and Scale nodes. Set Scale to Render Size and place it between Image and Alpha Over.
9. Hit F12 and render. As you can see there is a problem with a black outline around Shadow Catcher. Workaround for this problem is to turn off Render > Freestyle option.