Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.
In today's tutorial, Pratik Gulati takes a look at how to reproduce a model from a reference image, even if you don't have any information on the camera used! Let's take a look...
This tutorial is divided into two parts : an introduction covering the different types of perspective, and then how to apply this knowledge when modeling from a reference image.
Perspective is very important to keep in mind whilst creating architectural models; by understanding simple dimensions like the height of a door, or the average human height, we can often pick out visual cues which can then be used to recreate the models as accurately as possible. One of the biggest challenges in architectural modeling is trying to maintain a 'realistic' scale in our 3d application.
The different types of perspective
A reference image (whether drawing or photo) could be characterised with one of three different perspective types. The key difference between the three types is the number of 'vanishing points' - an actual point, or points, in the scene towards which all lines converge.
Let's now take a look at each type in turn :
An image with 'one-point' perspective will contain only one of these 'vanishing points', and as such there will be only 3 ways that lines in the scene can be shown - 1) running vertically, 2) running horizontally, or 3) at an angle, converging towards the 'vanishing point'.
Take a look at the example images below. In the top one, you can see that the camera has been placed so that it looks directly down the street. The fronts of the buildings are exactly perpendicular to this direction, and therefore present us with only vertical or horizontal lines. The tops and bottoms of the buildings (and the other lines in between) however, are all at an angle. If you were to take a pencil and ruler and extend these lines further into the scene, you would see that they all come together and cross at a single point, and that (as you've probably guessed), is our vanishing point.
The photograph below it shows the same effect, this time looking down a train track.
As you have probably inferred from the name, two point perspective has double the amount of vanishing points. If you take a look at the examples below, you can see that the camera is no longer positioned so that it's looking directly towards a particular vanishing point, and as a result the horizontal lines from the previous perspective type are now running at an angle - something that introduces our second vanishing point. If you were to extend all of these angled lines as before, you'd see that they now eventually meet on either the left or right side of the image. Vertical lines are still vertical however!
One other thing to take into account are 'horizon' lines, the imaginary line at the same height as, and running perpendicular to the camera. This can quickly be created by drawing a straight line between our 2 vanishing point, and is used to get an estimate for the height of the camera.
The photo shown gives a typical, everyday example of two point perspective - the corner of a building.
Three point perspective
This perspective type takes things to their natural conclusion. Our camera has now been rotated, giving us our two vanishing points, but also tilted to look either up or down at the scene. This tilting makes our previously vertical lines angled, introducing a third vanishing point either high above, or far below the scene. The examples below both show this three point perspective, and you can see just how much more dramatic this makes the image feel.
Putting this to good use
We'll now go on to produce a 3d model of the building shown below, using what we've learned above.
After analysing the image, it's clear that even though the front face of the building is directly facing the camera, there are lines to either side that are vanishing off to the left and the right of the image. Given that there are still many vertical lines present in the image, we can conclude that it's two point perspective, not three point. By joining these two vanishing points, we can see that the 'horizon' line runs about halfway up through the main entrance.
We need to import our image into 3Ds Max. To do this we'll first create a free camera in the front view, directly at 0,0,0 on our grid. As we don't have any lens information for the camera used, we'll choose 35mm (a good 'default' value) for our cam. If you're using more modern reference however, camera information can often be found in the properties of the image itself, as shown below :
Now add a Camera Correction modifier to our camera. This is used to minimize perspective distortion. Once added, hit Guess to have 3DsMax calculate some appropriate initial values.
Now select the camera view and press Alt+B to bring up the Viewport Background settings. Browse for your reference image, and then in the settings make sure to tick Match Rendering Output, Display Background and Lock Zoom Pan before pressing Ok.
Open the Render Settings, set the Output Size to match that of your reference image and then lock it.
In the Camera settings, turn on Show Horizon. Now the tricky part! First of all, you need to estimate the rough height of the camera in the scene, using the horizon line, and move your camera to that height. Now create a box to represent the very front face of the building, and position it so that it roughly matches the reference image (as shown below). It's now a case of rotating the camera on the X axis only so that the box matches up as closely as possible. If, after some experimentation, things aren't lining up as closely as you would hope, try altering the focal length of the camera.
This is not an easy process, and it does take some trial and error, but once you've gone through it a few times it gets easier and easier!
Once you have your camera set-up and in place, remember to freeze it so that you dont move it accidentally!
Now create a plane in the front view and extrude its left and right edges to match the main sides of our building. Remember, you don't want to move these new edges in Y at all - they would be straight in real-life! If you extrude and things aren't lining up, I'm afraid it's time to go back and tweak that cam rotation a little more...
Now select the three edges and connect them with 4 divisions. Adjust these divisions to match the features of the building as shown.
Now it's time to start modeling the details! Connect the edges on the front wall, and move the new edges into place to describe the outlines of the windows. You can now extrude these in for the
For the shape on top of the windows, I took a box, extruded it and then just tweaked some of the verts into position. Duplicate this shape 5 times (once for each window) as seen in the image.
I then used a cylinder to create the circular steps at the front of the building, and yet another cylinder and a few bent tubes for the circular border running across the top of the door. As you go, remember to convert to editable polys, and delete un-needed faces.
For the beading on the roof, I created a very simple shape (shown here in red), and then simply extruded it along the front edge.
For the window, create a plane in the front view and convert it into an editable polygon. Now bevel it in, delete the middle polygon as shown below and then apply a shell modifier to give the frame some depth. For the glass, you can create a new plane inside of the frame itself.
You can now duplicate this frame object to create 1 generic window, which can be grouped and duplicated/instanced into place wherever needed.
It's now really up to you how far you take this remodelling. You can leave it here, or continue on down to the finest details!
When you're happy with the model, you can light and render as per normal, and you should end up with something very similar to your original reference image!
I hope you enjoyed this tutorial, if you have any questions or comments, just let me know!