Insert CG in picture

(The Gardener) #1

Hi there!
Today, I found a picture and decided that it would be nice to place a CG-object in the scene. I never tried this before and I actually don’t have any idea how to render (with yafray) anything except the light setup I created for lighting my object as natural as possible.
Here’s the picture: Heres the picture, here my light setup with a simple organic thing. Not perfect, but a start.
What I need is to render only the organic thing in this room, the light that is casted on it from anywhere in the room - all this GI stuff, but not the room itself. How can I achieve this without using the internal blender renderer?

0 Likes

(RamboBaby) #2

It looks to me like you’ve done a very good job so far (but I think the floor color is a bit subdued and should be casting a bit more color on your object…much better than I could do BTW) so all you need to do is set an alpha channel for the object and then composite the whole deal together.

In Blender add a new scene (Empty), go to the render buttons and enable the Key option (next to Premul), make sure RGBA is enabled, be sure Solid is enabled on the render layer tab. Now go back to the main scene and select your camera and the object and press CTRL+L, select To Scene, then select the scene that you just created. This will add those objects to the new scene. Go back to scene 2, render as .png, save the render with F3(you won’t need any lights in the scene because you only want to render the alpha channel from the object and use it for your YafRay created image).

Now it’s time to composite. Create a new empty scene and add a camera. Now in the nodes compositor enable the Use Nodes button add an image node then duplicate it 2 times (SHIFT+D). In the first image node add the image that you wish to composite your object in, in the second node add the YafRay created image, and in the third add the image you created for it’s alpha channel. Select the object image node and Add>Converter>Set Alpha, then plug the alpha channel from the third image into the alpha socket of the set alpha node. Add an Alpha Over node (Add>Color>Alpha Over) and plug the result of the set alpha node into it’s bottom socket and the image socket from the first image node (your background image) into the top socket. Finally plug the output of the alpha over node into the composite node, enable Do Composite (on the render tab) and render the image. Voila.

You won’t get a shadow on the ground with this method. For that you’ll need a ground plane with a shadow only material. I’ll leave you to figure out how to do that on your own. There are tutorials on this site that theach you how to do that. It’s going to require a bit more compositing but I just gave you the basics of hhow it’s done with an alpha over node.

0 Likes

(The Gardener) #3

Hi, thanks for your reply! Because I was too impatient to wait, here is what I produced myself with a little different method:

http://www.sommer-ist-jetzt.de/files/pics/Raum_kl.jpg http://www.sommer-ist-jetzt.de/files/pics/Raum%20mit%20Ding_kl.jpg http://www.sommer-ist-jetzt.de/files/pics/Raum%20mit%20Monster_kl.jpg

The image for the alpha-channel was generated by rendering the scene with the internal renderer, using the IndexOb option in the render buttons, the composition similar to the one you described. The shadow however is partially hand-painted in the third picture, the rest done with some masking and compositing of the original render. Because I accidentally deleted my scene and I’m to lazy too redo all the lighting stuff, I will try out your method for the shadows in another real life picture and post the result.

0 Likes

(Lord of the Rings Junkie) #4

Cool, very believable!:slight_smile:

0 Likes

(RamboBaby) #5

You just won’t get the nice aliasing with that method that you get with a real alpha. You seem to have a rather funky halo around your objects also. That will not happen with the key option and a real alpha.

0 Likes