Understanding Compositing (Compositing and Postprocessing Techniques) (LightWave v9) Part 2

Exercise 16.2 Applying Front Projections

You’ve seen how easy it is to place a 3D object in front of a photograph. The look is convincing, and you can go further with moving images. But what if you need to make the Vase image blend more with the photograph? What if it needs to peek out from behind the other parts of the image? This exercise shows you how to do just that.

1. Continue in Layout from the previous exercise.

2. In the Compositing tab of the Effects panel, make sure the Foyer image is still set as the background image.

3. Be sure you’re in Camera view so that you can see the backdrop image (press d for Display Options to view backdrop images). You should see the background image pop up into the Layout screen when you select Camera view.

4. In the position the vase rests in now, it only needs a shadow and lighting, which you’ll create shortly. But for now, you want to make the Vase object appear behind other objects. Move the vase to the closer side of the foyer behind the larger planter, as in Figure 16.6.

Position the vase on the front side of the foyer so that it's behind the planter, or at least it will be shortly!


Figure 16.6 Position the vase on the front side of the foyer so that it’s behind the planter, or at least it will be shortly!

5. Press F9 to render a frame.

You’ll see that as in Exercise 16.1, the 3D object is pasted over the background image. But in this case, it needs to be behind the planter! You might think that’s a problem. Most compositing programs show you how to composite behind a solid object, like a rock or building, but what about something with an odd shape like the planter? LightWave makes it easy.

Now you add the foreground image and see how that changes your final output. You just need to create a mask for the vase in Modeler.

6. Jump into LightWave Modeler and press d for Display Options. Go to the Backdrop tab and load the same Foyer image as a background image for the bottom-left view. Increase the size to 5 m. Figure 16.7 shows the Modeler setup.

Note

You can make the Image Resolution 1024 for better display in your backdrop images. Do this within the Display Options panel, under the OpenGL tab.

7. Expand the bottom-left view and then zoom into the image, as shown in Figure 16.7.

Place the Foyer image in the background display in Modeler to create mask objects.

Figure 16.7 Place the Foyer image in the background display in Modeler to create mask objects.

8. Using the Pen tool from the Create tab, create a polygon in the shape of the planter, as shown in Figure 16.8. Just click to create points around the planter in the image. Feel free to zoom into the view, and make it full frame to easily align the Pen tool.

Note

When building this mask (or any mask), you only need to create enough of an object to meet your needs. For example, in the current exercise,you do not need to create a mask for the stairs, columns, or floors. You’re building a mask so that a vase can pass behind it. Therefore, you only need to create a polygonal mask for the planter that is big enough to make the Vase object appear to be behind it. If, however,you had a moving object, you would then need to build a larger mask.

Using the Pen tool, you can quickly create a mask for any area of an image.

Figure 16.8 Using the Pen tool, you can quickly create a mask for any area of an image.

9. After you’ve laid down the necessary points with the Pen tool, press the spacebar to turn off the Pen tool. Then, using the Drag tool (Ctrl+t), shape the points to better fit the image, if needed.

10. Press q (or the Surface button at the bottom of the Modeler interface) and name this new polygon PlanterMask. Then save the object.

11. After the object has been saved, send it to Layout from the drop-down arrow at the very top right of the Modeler interface, as shown in Figure 16.9.

Use the Send Object to Layout command at the top right of the Modeler interface.

Figure 16.9 Use the Send Object to Layout command at the top right of the Modeler interface.

12. After the object has been sent to Layout, move and position it so that it rests in front of the planter in the image. You’ll need to do this from the Camera view, as that is the only way to see the image in Layout. Note that a bit of sizing might be needed to properly place the mask. You can press Shift+h for Size. Press t for Move.

13. When the object is in place, create a keyframe at frame 0 to lock it down. Figure 16.10 shows the mask in place. You might find that a Wireframe view of the scene helps with aligning the mask.

A little bit of positioning in Layout puts the mask object in place.

Figure 16.10 A little bit of positioning in Layout puts the mask object in place.

14. Be sure to save the scene at this point. Don’t forget that pressing Shift+s saves incremental versions.

15. Press the F9 key to see how the scene looks. You should see something like Figure 16.11. The mask you made for the planter does indeed block the vase behind it, but the object is just gray.

Rendering a frame shows the mask in place blocking the vase but not really looking like part of the scene.

Figure 16.11 Rendering a frame shows the mask in place blocking the vase but not really looking like part of the scene.

Note

If your render doesn’t show any object mask, the polygons might be flipped. Back in Modeler, make sure the surface normal is facing forward toward the positive Z-axis. At worst, you can try clicking Double Sided in the Surface Editor panel directly in Layout.

16. Open the Surface Editor and select the PlanterMask surface. Then, open the Node Editor. You’re going to apply an image map to the mask.

17. Choose 2D Texture and then Image from the Node Editors Add Node drop-down. This creates an Image node (Figure 16.12).

Begin surfacing the polygon mask with a 2D Image node.

Figure 16.12 Begin surfacing the polygon mask with a 2D Image node.

18. Double-click the newly added node to open its Properties panel.

19. At the top of the Properties panel, select the Foyer as the image. The other settings can all remain at their defaults, except for one—Mapping. Change this to Front, for front projection mapping, as shown in Figure 16.13.

Front projection image mapping is one of the most powerful compositing tools LightWave has to offer. It enables your 3D objects to interact with your 2D images in almost every way that they can interact with other 3D objects.

Front projection image mapping works by—you guessed it—projecting an image onto an object. The image is "projected" from the camera’s point of view such that it would appear exactly as though it were a background or foreground image.

The Image node with a front projection map applied.

Figure 16.13 The Image node with a front projection map applied.

20. Now all you need to do is hook the Image node into the destination node to apply it to the PlanterMask. Drag the Color output of the Image node to the Color input of the destination node, as shown in Figure 16.14.

The Image node is hooked into the Color input of the destination node.

Figure 16.14 The Image node is hooked into the Color input of the destination node.

In most cases, you’ll need to adjust the Luminosity and Diffuse values for the front projection-mapped surface. Because of the lighting in the scene, you need to carefully balance these two values so that the polygons that make up the mask perfectly blend and match the background image. In this particular tutorial, the mask is small, so making it blend is not too difficult.

Note

Remember to move, rotate, size, and stretch the mask object. Render a frame. It will always show a portion of the image, no matter where you place it or what its angle is. Remember that by using OpenGL Textured Shaded Solid view, you’ll be able to see your textures applied in real time, directly in Layout. Rendering an image gives you a more accurate idea of the setup with surface values.

21. To make the mask blend a bit better, close the Node Editor. Then, back in the Surface Editor, set Luminosity to 40% and Diffuse to 70%. Render a frame again (press F9), and you’ll see that the front projection mask is easier to see, but the lighting needs to change.

22. Select the light, which currently is a default distant light, and rotate it so that it’s above, behind, and to the right of the camera. Figure 16.15 shows the Perspective view with the light position change.

Position the light so that it is behind and to the upper right of the camera.

Figure 16.15 Position the light so that it is behind and to the upper right of the camera.

23. After the light has been changed, press F9 to render a single frame. You’ll now see that there is little difference between the polygon mask and the background image. Figure 16.16 shows the example.

After the light has been rotated and positioned, the render shows a better blend between the front projection mask and the background image.

Figure 16.16 After the light has been rotated and positioned, the render shows a better blend between the front projection mask and the background image.

Note

The way a distant light, such as the one used here, affects a scene is independent of its distance from the lit object. (Only its angle relative to the object affects shadows, reflections, and the like.) But it’s still a good idea to move the distant light anyway. That way, if you decide to change it to a different light type, it will be positioned correctly in the scene.

24. Oh, and did you save? Yep, gotta save all objects to save the surface changes, and be sure of course to save the scene.

However, the vase itself still looks like it’s floating, and it’s not textured. This is because all the elements in the background image have shadows, but your 3D vase does not. Shortly, you’ll learn how to create matching shadows to finish off your composite. But first, read on to the next section, which takes a different approach on compositing in LightWave using foreground images.

Foreground Key and Foreground Alpha

In the next exercise, you’ll learn about the Foreground Key. The Foreground Key is nothing more than a color-keying system, such as the blue- and green-screen systems used by TV meteorologists and in visual effects throughout the industry. It works by keying out,or removing a range of colors that you specify. LightWave gives you two colors: a Low Clip Color and a High Clip Color.

The Low Clip Color is generally the darkest, most saturated color you would want to remove from your foreground image. The High Clip Color is the brightest, least saturated color you’d want to take out. Any colors between these two colors are removed from the foreground image before it’s pasted over the rendering. For Exercise 16.3, you’ll take out the sky to reveal a new background. There’s no Adobe Photoshop involved—it’s all done directly within LightWave.

Exercise 16.3 Setting Up a Foreground Key

To do this, you want to pick the darkest, most saturated color in the sky and set this to be the Low Clip Color, and you’ll set the brightest, least saturated color for the High Clip Color.

1.In the Compositing tab of the Effects panel, apply the loaded image as a Foreground Image, as shown in Figure 16.17. Then, check Foreground Key.

Load the Fountain image as the Foreground Image in the Compositing tab of the Effects panel.

Figure 16.17 Load the Fountain image as the Foreground Image in the Compositing tab of the Effects panel.

2. Set the Low Clip Color to R:118 G:168 B:239. Set the High Clip Color to R:180 G:218 B:254.

Now, you’re probably wondering where these values come from. Although you can use another image-editing program to determine the color value of the Low Clip (the sky in the fountain image), you can do it directly in LightWave. The following steps show you how.

3. From the Render tab at the top of Layout, select Render Globals. In the Render Globals panel, set the Render Display to Image Viewer. You’ll see two options there: Image Viewer and Image Viewer FP ("FP" stands for "floating point"). The FP version is useful for determining values for high dynamic range (HDR) imagery.

For this project, you want to use just the Image Viewer for RGB images (not Image Viewer FP). You can simply select a color based on your own eye. Remember, this is a range of color, high and low—it’s not specific.

4. Press F9 to render a frame. After the frame is rendered, the Image Viewer opens. Move the mouse over to the sky. Click and hold the mouse and look at the title bar of the Image Viewer panel. Figure 16.18 shows the Image Viewer.

Using LightWave's Image Viewer from the Render Globals panel, you can easily find RGB color values of your background image.

Figure 16.18 Using LightWave’s Image Viewer from the Render Globals panel, you can easily find RGB color values of your background image.

Values appear there! Those are the RGB values of the image where the mouse is. You’ll see four values—Red, Green, Blue, and Alpha. The first two sets of numbers before the dashed line are the pixel number of the image.

The RGB values (118,168, and 239, respectively) for the Low Clip Color setting were determined using the Image Viewer. Cool, huh?

Note

You can set color values quickly by clicking and dragging each of the color values to the desired color, in the Foreground Key settings.

5.This is a simple flat polygon, or plane, with a moon mapped onto it that you can use for compositing in this exercise. Move the plane back into the frame and position it so that it’s rising up from behind the buildings, as in Figure 16.19.

 Load the Moon object.

Figure 16.19 Load the Moon object.

6. Press F9 to render a frame, and you’ll see the moon scattered through the trees, sky, and building, as in Figure 16.20.

 Even though you've set the High and Low Clip colors, the range is too small for LightWave to key out the sky, so the moon is partially obscured.

Figure 16.20 Even though you’ve set the High and Low Clip colors, the range is too small for LightWave to key out the sky, so the moon is partially obscured.

7. Often, the color values you set for the Low and High Clip values aren’t enough. So, hike the High Clip Color values to R:195 G:235 B:255 in the Compositing tab of the Effects panel. Reduce the Low Clip Color values to R:110 G:150 B:220.

8. After you’ve set the new clip colors, press F9 again. You’ll see that the moon is clearly visible, but the area behind it is black. So, in the Compositing tab, set the Background Image to the Fountain.jpg as well. Then, render again by pressing F9. Figure 16.21 shows the moon now rising up from behind the buildings.

With a slight change in the High Clip Color, the moon now appears to be rising out from behind the buildings.

Figure 16.21 With a slight change in the High Clip Color, the moon now appears to be rising out from behind the buildings.

This is a good technique to use when your foreground image can support it. The example here can use a little tweaking in the High Clip Color area, which you can experiment with on your own. The less variation between the High and Low Clip colors, the better. And, the less area to be keyed out, the better. While this is not the best keying method you could choose, it is a quick way to consolidate operations and software, while maximizing time. In this case, the image was a good candidate for this technique because the area you needed to key out was a large bright area with little variation in color, and it was significantly different in color than the rest of the picture. For the sky, this image was good to use because there is a clear distinction between the buildings and the sky. There is little haze and a strong variation in brightness and color.

Next post:

Previous post: