I was wondering how you would go about putting a 3D object into a photograph so that portions of the image are:

  1. In front of, or
  2. Behind the model.

For example, a photo taken from the roadside with a tree in the foreground. I want to show a 3D model of a car in the photo on the road but a section of it is not visible because it is obscured by the tree.

Is this possible? If so, how can you do it?

Thanks in advance.

  • $\begingroup$ Try out the camera mapping techniques: blenderguru.com/videos/camera-mapping-tutorial-v2 $\endgroup$ – user703 Jun 16 '13 at 13:29
  • 1
    $\begingroup$ two posts that will interest you: cycles holdout material and cast shadows on footage/stills $\endgroup$ – zeffii Jun 16 '13 at 13:31
  • $\begingroup$ while the answer to the question here is contained in both those links, I don't feel this question is a direct duplicate. It manages to ask a very succinct question and therefore is a good example of how to ask this question. $\endgroup$ – zeffii Jun 16 '13 at 14:12
  • $\begingroup$ The most important part is covered by Jozsef but I would suggest you to dig a little in to image based lightning. You can do it with a regural mirror ball. It helps a lot in compositing CGI into footage - especialy that car ... is reflective:) $\endgroup$ – user710 Jun 16 '13 at 18:02

To bring some sort of closure to this question (as it's sure to get asked in the near future again), to get shadows and add a bit more realism, you can refer to the answer on How to make a model cast shadows onto the world texture/background?.

To answer this question with the one thing not mentioned there. You don't really need to use compositing here as you might have thought, the simplest way to do this is to model an object to mimic the shape of the object you want to use to obscure your other object(s) and while some people have and or will use some complex node setups, you can just add a new material to the 'mask object', enable Transparency, set it to Mask and turn the Alpha to 0 like this..

enter image description here

Here is the setup of my scene, the tree trunk has the 'mask' material applied to it and I have a ground plane to catch a little shadow to make it a bit more realistic.. I grabbed the picture of the tree from here.

enter image description here

and here it is rendered..

enter image description here

How to get it to look better is up to you and what you want..

  • $\begingroup$ Is there a quick way to do this in cycles? $\endgroup$ – Unnamed Sentient Being Sep 1 '16 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.