how to combine a photo and a cg object

based on the winner picture now a step by step tutorial. this is a remake of the project, not the one we have made for the dialogos.
first step:
make a photo of the scene or object. it is good to shot some more photos with different exposure if u haven't a digicam or only 24 bit rgb images. we haven't so much time befor the demo party so we have taken only one photo with a canon powershot g2 in raw modus, converted the picture to a 16 bit (48 bit) tiff. this way provide the possibility to tweak the levels without losing any detail. it is important to measure the position of the scene and the camera, you will need this later for the cg scene. it is also usefull to take some shots from the real model to get a feeling for the lighting on the surface.
scene01 scene02 scene03 scene04 scene05

second step:
creating a hdr image. there are different ways to build a hdr image. fisheye or mirror ball. if you want to use a camera with a wide angle lens you must take many photos and stitch them together. this will be a very hard way for macro hdr's. you can use this method for large areas and very high detail images. the final resolution of the hdr or panorama is depending on how much photos you have taken to capture the whole sphere around you. if you are using a mirrorball the source for the hdr is only this one picture because the mirrorball reflects the whole scene surrounding. how you can see on the pictures in step 1 there is a shadow of the camera on the notebook and the ball. try to avoid such things. change the position of the camera or place the tripod on a different side. ok, we have used the mirrorball and for this scene we have taken a small yingyang ball with a diameter of 5 cm. the final car for the picture is only around 300 pixels high so we don't need this kick ass high resolution hdr. the photos are taken with the canon g2 too and the croped picture is around 1300 pixels width and high. you need around 6-10 pictures for a good hdr. it is important to get a really dark picture, nothing should be white in this pic, and a bright picture.
it is depending on the quality of your camera, many digicams tends to color changes if the image is too bright or the bright areas are overflow into the dark areas. import this pictures into a pixel programm like gimp or photoshop and kick the trash around the ball. it is important to crop all pictures the same way, they must be really congruent.
mirrorball02 mirrorball03
if you want to use this hdr with the image world plugin in lightwave (and this is what we want) you need a fisheye image. a photo of a mirror ball is a convex mirror. convert the pictures (yes, all) to a fisheye, there are different ways to do this. we have used for this step the pan tools from Helmut Dersch.
convex2phspheremirroball04 mirrorball05 mirrorball05
now it is time to put them together. there are many tools for this step, try hdr shop from debevec or radiance tools. use a picture with well balanced lighting as the reference picture and as the standard exposure picture. the better way is to shot 2 series of photos from different angles. with this method it is possible to fill the area behind the ball (you can see the distorted edge in the final image) and to rip the camera and the stativ from the final picture. do the same way on both series and clone brush the areas in the picture after the first conversion. ( into the panorama)
you can find a collection of hdris at if you don't want to go through the making of an own hdri

third step:
the cg object. ok, for our project the car was done befor and we had no more to do. if u plan to include an object into a picture it is important to know how should look this object later. you can add details with bumbmaps or model these details. we prefered the model method, this is better for close ups and for radiosity lighting. next important feature is the surface. study your reference object in real life with different lightings and different angles. it is also good to study the object on different daytimes. close one eye to avoid the 3d effect (this is very important for reflections and refractions). don't try to add spectacular effects, it won't look real later when adding the object to the photo. pay attention to details like scratches or stickers. a sticker is not flat on an object and does really have other surface settings than the ground. we have modeled the stickers for the cars and gave them other surface settings. render some tests with different lightings and angles or create a small animation to get a feeling if it look real or not. the following pictures are screenshot with a large resolution (around 220kb)
car02 car03 car05

fourth step:
the scene. depending of the real scene you will need an object to cast the shadow of the cg object to put this shadow into the photo. our focus was the real lighting, created by a hdr, so we have used radiosity and image world (lightwave plugin). here appears the first big problem. you can export any shadow buffers from lightwave as a picture but not shadows created by radiosity. so we need a small trick for this step. but let us continue with the scene. set up a scene with the same angles, positions and the same zoom for the camera. if u have modeled some ground objects or something like this you can use front projected image maps to get a hint for the setup. add some assistant lights for the placement of the cg object. you can create a lighting setup from the hdri with hdr shop. this is necessary because backdrop lighting is not visible with open gl preview. but i use often a combination of one or 2 lights and switch off the 'affect diffuse' and 'affect specularity' option.
first picture, the car is placed on the keyboard, second picture, the camera view with correct distance, angles and zoom.
layout01.jpg layout02

fifth step:
rendering the cg object. depending of the deadline or the hardware used for this project you must find a good balance for the radiosity settings. for smooth objects with low details you can use lower settings but you will get some grainy noise. if you use reflections or refractions it will take ages for rendering with high radiosity settings. decrease the ray recursion limit on the rendering settings dialog. nobody will see a different between 4 or 16 steps, except refractions in glass spheres with some nifty details within ;-). this will heavily decrease the render time. keep in mind the final resolution of the cg object. after the first rendered pictures try to put these picture into your photo. if everything works properly this first composite should look good. not perfect but good. now it is time to catch the shadow. i think there are two ways to get the shadow as a single layer without any objects included in this layer. first one, create a scene with good matching lights (hdr shop) and use the render buffer plugin from lightwave. we have taken the other way. you need three pictures. first one, the cg object without the one who will receive the shadow, second, the object that receive the shadow with the shadow and without the object, and the last one, the object that receives the shadow without the shadow and the object. here occurs a main problem with our keyboard, the keys produce also a shadow and with low radiosity settings, this shadow will be different between these three images. to avoid this, use a flat object under your cg object, if this won't do the trick, then you must render images with better radiosity settings. look at the third picture, the interesting white area beneth the front left tire (on the right side). such details are not included in the version with the flat shadow. there must be a second effect. if a ray of light hit an object the light will be reflected (if the object is not black etc) and this light will influence the enviroment. this means, our cg object can light up the enviroment. we have currently no practicably idea how to include this in this work flow but we have some ideas ;-)
first picture, the rendered car only, second, the fake shadow on a flat shape, third, the shadow on the keyboard.
comopsitecar.jpg flatshadow keyboardshadow
if you use a macro photo or a photo with a depth of field effect you must try to produce this effect too. there are some dof calculators for cameras. i use fcalc from

sixth and last step: now it is time for some pixel based actions. load these three pics into your favourite programm and substract the picture 3 from picture 2. now you should get a picture of the shadow only. it doesn't matter that there are some holes in the shadow now. this places are the location on which the shadow should be in nature too and it is not necessary that u add here the shadow again. tune this one a little bit, remove some grainy stuff around the shadow and add a little sharpen effect to this pic. put this layer into your real photo. load the first picture into the real photo and arrange the layers. now your are very close to the finish line. try to convert the shadow to a greyscale image and check this. it is possible that the color shadow looks a little bit ugly because the color affects the photo.
to be closer to the reality we have done some additional steps. first, a photo is never without noise and doesn't have these clear and bright colors of a rendered picture. we have lowered the saturation and we have added small noise to the rendered image. if you want to be perfect, you can shot some white and black areas with you camera and try to separate the noise from this pictures. then you can add this noise to the rendered image. if you have used high antialiasing settings it is not necessary to unsharpen the cg image, but look at you photo and try to get the same sharp effect. the last step on our project was to add an additional screenshot to the photo to get a brighter and sharper screen on the notebook. with a opacity of around 25% we have added the perspective screenshot to the photo.
congratulations. the picture is complete now. here a screeny of the layers and our final image (different sources used).
layers.jpg screenshot final image

thanks for reading, i hope it will have some positive effect to your work. comments and corrections are welcome. contact us via email and visit our 3d thnx 2 #lightwavers, visit the homepage @ lightwavers or join our channel #lightwavers on efnet, undernet or dalnet.

more related links:
modeling the wheel
hdri lighting
speed up hdri renderings
tutorial index at dbki