# Integrating 3D Objects into 2D Environments

## Integrating 3D objects into 2D environments

To begin, I have chosen a photo that I took myself when I was on holiday in Italy. I will use this photo because it doesn't contain a direct light source (in this case the sun); it has a nice diffused light that we can easily match to the techniques I will demonstrate and doesn't need complicated 3D geometry to get good results! In future tutorials, we will look at different lighting scenarios and more complicated images, but for now its important we start with the basic principals.

## Step 1: - Set the image to be your background in LW layout

In your display options set "camera view background" to "background image" - Fig.01

Set the image as your background by selecting it in the "effects" window - Fig.02

Set your camera height and width dimensions to be the same as the background image you are using; in this case my image measures 1280 x 850. You can use the image editor window to get this information if you don't already know it - Fig.03

Fig. d_FIG-1.

## Step 2: - Adjust camera rotation and position to match that of the image

Using your layout Grid as a guide, try to line the elements in your background image with the lines of the grid in the "camera view" window.

Try to keep to real world measures; my grid is set to 1m and my camera is positioned in such a way so that the things I judge to be 1 metre away in the image are 1 grid square away in LW - Fig.04

Fig.

## Step 3: - Adding geometry to the scene and surfacing the ground plane

For this project, I will be adding a simple primitive object onto the right side of the image. In order to achieve the level of realism I am looking for, I need to add a ground plane which will catch the shadow of my object. I made a simple 1 poly ground plane and brought this into my scene. It was then rotated and moved and aligned with my camera grid lines to match the existing elements in the photo - Fig.05

Fig.

In order to match the surfacing of the ground plane to that of our photo we need to use a technique called "front projection mapping". This will allow whatever part of our image that the ground plane covers to be displayed on it's surface, enabling seamless integration of the 2 elements.

In order to do this, open your surface editor and choose the colour channel of the ground object and set the layer to "image map", the projection to "front" and the image to your background image - Fig.06

Fig.

Render out a frame and you can see we are already close to what we want - Fig.07

Fig.

## Step 4: -Lighting

Currently, our ground plane isn't seamlessly integrated because our LW lighting setup doesn't match that of the photo, so consequently the ground plane sticks out a mile.

We need a way to create some soft ambient diffused lighting to match our images.

We can do this using global illumination, or ambient intensity, however neither of which cast shadows, so a good way is to 'fake it' by using the "spinning light trick"

This involves an array of lights spinning very quickly to produce the kind of bounce light you find in day-time lighting. We could do this manually, but its a longwinded process and takes time. Instead, we will use an excellent plug-in called "overcaster"By eki halkka (http://www.kolumbus.fi/erkki.halkka/plugpak/index.html). This can be downloaded and installed for free, however I do urge you to register and pay a small fee for such an excellent plug-in (please follow the installation instructions on eki`s website). Once downloaded and installed as a normal plug-in, we can use the "oc ambimage" part of the plug-in to create our nice soft diffused lighting.

Click the "oc ambimage" button on the menu, which the installation creates for you. Simply accept all the default values and choose "ok" until the plug-in installs a slider lighting control in your scene - Fig.08

Fig.

Select your original LW distant light and remove it from the scene.

Adjust the scene to start at frame 2 and adjust your camera's motion blur to "dithered". This will allow the lights to complete the "spin" and give more accurate shadows - Fig.09. This time, make sure that "ray trace shadows, reflection and refraction" are enabled in your render options panel

Fig.

As you can see, the ground plane is still too dark. You can now adjust the ground planes luminosity and diffuse channels until the surface of the ground integrates seamlessly with the photo. It takes a few tweaks and renders but I found upping the luminosity to between 17 and 18% gave me a seamless integration - Fig.10

Fig. _fig-9..jpg

## Step 5: -3D Objects

Now is a good time to save your scene and all objects!

Now we have successfully completed our ground plane, you can add 3D objects on top of this plane and their shadows will cast onto the ground - integrating them into the scene. For this, I choose a classic mirror ball, nothing fancy - just a sphere with a high reflective value, and "ray tracing + spherical map" applied in environment options of it's surface, and the background image was chosen as the reflection map - Fig.11

Fig. 10

Render a frame and you can see how well the 3D elements have integrated into the original photo - Fig.12

Fig. 11

For extra realism, rotate the reflection map on the mirror ball 180 degrees and tweak the surface diffuse and reflection channels to match as you want.|

Obviously, this is just the basics. Extra geometry could be added so that you can catch shadows on different elements in the image, and different lighting would require either more or less ambient light, so you would have to tweak your Sliders until you find out what works best!

To see more by Neil Maccormack, check out Prime - The Definitive Digital Art Collection