Home :: Login :: Forgot Password :: Search :: FAQ
Support our host

News

Software

Reference

Community

Parts Library

About Us

Reference > Tutorials
Published By OrionP on Monday, March 29, 2004 - 05:28 AM

Printer-friendly page



What is Compositing

Compositing is the process of combining a 3D model with a 2D scene to make the final model image look like it is actually in the scene.An example of this is shown in figure 1.

Figure 1: Compositing a POV-Ray render with a desert image
Requirements for Tutorials
Software: Ensure that you have installed the following applications on your computer
  • LDraw
  • L3P
  • POV-Ray v3.5

These application can be installed all at once with the LDraw-All-In-One Installer.

  • a paint program (eg. Paint Shop Pro, Adobe Photoshop, Macromedia Fireworks, etc.)
Files: Download the following files so that you may walk thruogh the tutorial.
Step by Step (All Paint Programs)
Step 1 Create a folder called "composit" and place the swoop.ldr file in it. In our tutorial we use the path of "C:\composit"
Step 2

Convert the swoop.ldr file into a POV-Ray file by using L3P with the L3PAO graphical user interface. It does not matter what setting you use for L3P as long place the camera at a latt of 10 and ensure you have a floor. A latt of 10 is used becuse that is a good camera height in real life. Figure 2 shows the settings we used to make the swoop.pov file.

Figure 2: Converting a LDraw file to a POV-Ray file
Step 3

Open up the swoop.pov file and locate the floor code which looks like this:

// Floor:
               object {
               plane { y, 32 hollow }
               texture {
               pigment { color rgb <0.8, 0.8, 0.8> }
               finish { ambient 0.4 diffuse 0.4 }
               }
}
            

Hint: Look at line 3784 in the POV-Ray file.

We do not want POV-Ray to render the floor just yet. So we need to remove it but NOT delete it. So we are going to "comment it out". That is the code will become comments and not POV-Ray code. To "comment it out", we use the symbols "//" in front of the line of code. So your floor code will look like this:

// Floor:
               //object {
               // plane { y, 32 hollow }
               // texture {
               // pigment { color rgb <0.8,0.8,0.8> }
               // finish { ambient 0.4 diffuse 0.4 }
               // }
//}
Hint: Comments are in green text in POV-Ray
Step 4

Render the file with a resolution of 800x600, use the drop-down menu (label 1 on figure 3) to choose your image size. Click on the run icon (label 2 on figure3) on the menu bar to begin the render process.

Figure 3: POV-Ray menu file
Step 5

Locate your newly created image file (swoop.bmp) and rename it to swoop_nofloor.bmp. The image should look like figure 4.

Figure 4: swoop_nofloor.bmp
Step 6

Now we want to render the swoop bike but this time we only want the bike's shadow.

Locate the following code,

object { swoop_dot_ldr #if (version >= 3.1) material #else texture #end { Color7 } }

and place your cursor between the last two "}".

(Hint: Look right above the floor code we commented out on line 3781)

On the POV-Ray menu bar locate the "insert" menu and select the "shape modifiers" sub-menu and then click on "no image". See figure 5 if you need help.

Figure 5: The POV-Ray "no image" command

Note that the "no_image" command is now part of the object code.

Step 7

Now before we render the image WITHOUT the swoop bike we need to put back the floor so we get the swoop's shadows. So remove the "//" that you placed on the floor code in step 3. When you render the code you will notice that you get an image with 3 shadows as shown in figure 6.

Figure 6: Swoop Bike with 3 shadows

We only need one shadow as it will be easier to extract one shadow later on in our image editor. In oder to remove these shadows we need to make some of the POV-Ray lights "shadowless". That is lights that provide "light" but do not cast shadows!

Step 8

Locate the light code in your pov file it should look like this:

// Lights:
light_source {
               <0,-508.575,-541.975> // Latitude,Longitude,Radius: 45,0,700
               color rgb <1,1,1> 
}
light_source {
               <525,-363.6,256.109> // Latitude,Longitude,Radius: 30,120,700
               color rgb <1,1,1> 
}
light_source {
               <-303.109,-619.818,128> // Latitude,Longitude,Radius: 60,-120,700
               color rgb <1,1,1> 
}

You want to add the keyword "shadowless" to the 2nd and 3rd lights at the ever end before the "}" symbol.
Why those? Simply because we like the shadow created by the 1st light more than the other two.
Render the file again with the same resolution as before. (We used 800x600 the last time).
The code below has been modified to show the "shadowless" keyword.

// Lights:
light_source {
               <0,-508.575,-541.975> // Latitude,Longitude,Radius: 45,0,700
               color rgb <1,1,1> 
}
light_source {
               <525,-363.6,256.109> // Latitude,Longitude,Radius: 30,120,700
               color rgb <1,1,1> shadowless
}
light_source {
               <-303.109,-619.818,128> // Latitude,Longitude,Radius: 60,-120,700
               color rgb <1,1,1> shadowless

}
Step 9

Locate your newly created image file (swoop.bmp) and rename it to swoop_shadow.bmp. The image should look like figure 7.

Figure 7: swoop_shadow.bmp
Depending on what Paint Program you use the following steps may differ. In this tutorial we use Jacob's Paint Shop Pro.
Step-byStep: Jacob's Paint Shop Pro
Step PSP 1

Open up swoop_nofloor.bmp, swoop_shadow.bmp, and desert.jpg. Your images should look similar to figure 8.

Figure 8: Working images in Paint Shop Pro
Step PSP 2

From the swoop_nofloor.bmp file we want to select just the model to place into the desert.jpg image.
Select the magic wand tool and set the tolerance to about 45, then click in the blank area (white area) of the model image.
Click on “selections” and then on “invert”, (see figure 9) you should now have only the model select.

Fihure 9: Swoop model selected

Click "copy" and opne a new file and click on "paste" to complete this step.

Repeat this step for the swoop_shadow.bmp file and just extract the shaodw. You should now have two new images as shown in figure 10.

Figure 10: New images of swoop and swoop's shadow
Step PSP 3

Now its time to import your two new images into the desert image.
First select the new swoop shadow and click "copy". Open up the desert image and click "past as new layer" (see figure 11).

Figure 11: Pasting as new layers the swoop and it's shadow.


Adjuste the layer opacity of the shadow to 75% and place like shown in figure 12.

Figure 12: The swoop shadow in the desert image
Step PSP 4

Now "copy" and "paste as new layer" the swoop model and align it with it's shadow adn shown in figure 13.

Figure 13: Swoop and shadow in the desert.

Now you can see that it fits in pretty nicely but it still needs something. So what you have to do is go into the color menu and play around with the colors such as channel mixer, gamma correction, etc. until you get it to look like it’s actually there. You can also do other things such as add a little dust, or soften the shadows edge, and make the edges of the swoop bike blend more. Play around with it so you can get it how you want. The image in figure 1 has a much softer shadow than figure 13. This was done by using the soften technique under the tools option.


Help Desk Tutorial: Compositing 3D Models with 2D Scenes
Version 1.0 (01 Apr 04)
Created by Todd Dillard (dillardtrd@hcsmail.com)
Edited by Ahui Hererra, LDraw Help Desk
http://www.ldraw.org/



Recipient 2007
Kevin Clague

Want to learn more about LDraw? Check out the following books:




Current Contest Winners

Model of the Month


Scene of the Month



Vote for Next Month's Winner

Submit Your Creation for Next Month's Contest

What's new in lugnet.cad?

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Willy Tschager - 13 hours ago

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Jim DeVona - 19 hours ago

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Daniel Siskind - 19 hours ago

Re: Questions About Selling Custom Model Instructions: Confirming LEGO/LDraw Consent
by Orion Pobursky - 19 hours ago


There are 54 unlogged users and 0 registered users online.

You can log-in or register for a user account here.





 


 Log in Problems?
 New User? Sign Up!

©2003-2008 LDraw.org, see Legal Info for details.
LDraw™ is a trademark owned and licensed by the Estate of James Jessiman
This website is powered by Peeron.com.

LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this site. Visit the official Lego website at http://www.lego.com.
LDraw is a completely unofficial, community run free CAD system which represents official parts produced by the LEGO company.