How to Combine a Photo and a CG Object

1st step - take a photo of the scene or object

It is good to shoot some more photos with different exposure if you 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.

2nd 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. As 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 tend to color changes if the image is too bright or the bright areas are overflow into the dark areas. Import these 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.

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.

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. 

3rd step - the cg object

OK, for our project the car was done before and we had no more to do. If you 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).

4th 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.

5th 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.

6th 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).

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.

Fetching comments...

Post a comment