How to match CG to a photograph?

I had tried a videotutorial from Mookie, but I’m having a hard time matching the camera lens’ focal length. You can see the video here.
When I increase/decrease the Focal Length to match my cube to the building in the photo, the cube only gets larger or smaller. But its sides do not change to eventually match those in the building in the photo :frowning:

Does anyone know how to solve this, or any other tutorial on this?
I’ll be greatly appreciated.

Thanks in advance guys :slight_smile:

P.S. Not sure where this post could go, but since there’s (or could be) some modeling involved…

As I see it, the blender version is pretty outdated…The person in the video did not adjust to focal length, they just rotated the cube on the Z-axis and adjusted the picture to fit onto the camera lens…focal length lad to do with zooming in/zooming out, not perspective.
I’m not sure it this is your answer…

Thanks for helping dancreator :slight_smile:
I don’t know if the Focal Length and the Lens value he modifies is the same thing, but at 1:53 in the video, he does the latter. The text showing says: “Play with a lens value until the edges of the cube will become paralell to the edges of the building”. I’ve tried a combination of 1. changing the lens value & 2. moving the cube up / down, but without avail :frowning: At first it looked like that would be the way, but I can’t seem to get it right.
If you want to check my .blend … I hope this link will work for you. Let me know… I can try some place else otherwise.


Finally I came across that tutorial showing basically the same thing, but done with a different method. From Blender Cookie. I’ll check it out.
Would like to hear what’s your take on my file with Mookie’s method though.


Use the BLAM add-on. It will calculate focal length and align the camera.

Steve S

Correction… The tutorial from Cookie Blender called “Modeling a Building in Blender”, was indeed to do just that, “model a building”! Dooah! I was hoping it was to match something CG with that building in the photo.
Obviously I had let myself go by what I wanted it to be, and what it looked like (to me) at 1st sight. Oh well!


I did test blam from dfelinto github: all i needed to do to get it work was to add one line of code

427 return True

to disable blender version checks; on buildbot builds it should work.
Did use 3 point perspective and get to this in one try

Thanks a bunch eppo :slight_smile:
Are you saying that if I don’t use this line of code “somewhere/somehow” I won’t be able to make it work?
If so, I hope it’s not too complicated :frowning:

Btw, unless you know of a documentation somewhere explaining the procedure, would you mind laying out the steps one is to follow to get this done?


Let me start with that i was doing this on XP 32bit blender and was not able to click Calibrate Camera button without getting error boiling down to “There is no attribute build_revision”. This was a bit surprise so i did track to some blender code, saw it was mentioned there yet error was present. Remembering that this was check to see if older version of blender was used where some matrix operations were changed i decided to just delete that part of the code - line i suggested was the fastest way to get rid of this version check.
I did repeat installing dfelinto’s git version of blam on Linux and turns out there is no such attribute error i encountered on windows.
To be more precise i have blender r61065 on my linux box here; can’t get to win box right now.

Did use your file, deleted all objects except Camera and brought image into Movie Clip Editor window. Drew GP lines like in image 1 and choose settings like in 2. In 3d view dropped in default cube placing 3d cursor approx in the middle of camera view ( 0 on numpad), in edit mode wireframe adjusted faces to match the building.
Unwrap selected visible faces using Project from View, assign materials.
Img 1
Img 2

Thank you so much for taking the time to explain your procedure eppo :slight_smile:
I don’t seem to have those settings you show in img 2 :frowning:
Unless I should do something “magical” to trigger these settings I have no idea how to get’em :frowning:


It should be present in Movie Clip editor window t-panel if BLAM is installed and selected in user prefs.
You have to load your image as a Clip i guess.