Reference: Tutorials: Tips and Tricks: Freeform Camera Positioning with MLCad, L3P, and POV-Ray
Freeform Camera Positioning with MLCad, L3P, and POV-Ray
By: Brad Hamilton
One of the hardest issues to grasp when starting out with MLCAD, L3P, and POV-RAY is figuring out how to position the camera to get the desired shots. Various techniques exist for camera positioning, but this article seeks to discuss one of the easiest and most powerful.
MLCAD describes 3D points using three different coordinates: (x,y,z). If you are looking at the front of a model, the X axis defines how far a point is to the left or right. The Y access defines how high a point is (i.e. up/down). The Z access defines how far the point is away from the viewer (i.e. in and out). L3P translates these coordinates into a POV-RAY file for 3D rendering.
Finding a Point in MLCAD
A key to this technique is to locate the position of the camera and the position of the "subject.' The subject is a point at which you want the camera to point or "look at."
To locate a point, load up the desired model in MLCAD. Typically, the upper-left view shows the front. If it is set to something else, reset it to show the front. The lower-left view should show the model from above. Make sure this view is set to show the model from above.
Now, move the cursor onto the upper-left view and position it where you would like the camera to be. At the lower-left of the application window (in the status bar), MLCAD displays the coordinates of that point. You can only register two of the coordinates in any one view. Notice how the coordinates change as you move the cursor. Write down the X and Y coordinates based on the cursor position.
Next, move the cursor onto the lower-left view, again where you want the camera. This is necessary to get the third coordinate. When you've found the spot, write down the Z coordinate.
Repeat this process to find a second point at which you want the camera to look. Often, the center of the model is an ideal spot.
Keep MLCAD running while completing the rest of the process, as the procedure can be repeated to find different camera locations.
The L3P utility is used to generate a POV-RAY file from the MLCAD output. Although L3P supports some camera positioning options, this technique doesn't use them. Just generate a POV-RAY file for your model using the default options.
Using the Point in POV-RAY
Load up the POV-RAY file. Scroll down to the bottom of the text representation of the file. Near the bottom, you will see something like the following:
// Camera (Latitude,Longitude,Radius = 0,180,0)
#declare PCT = 0; // Percentage further away
#declare STEREO = 0; // Normal view
file://#declare STEREO = degrees(atan2(1,12))/2;
// Left view file://#declare
STEREO = -degrees(atan2(1,12))/2; // Right view
location vaxis_rotate(<80,-600,-1400> + PCT/100.0*<0,0,3106>,
// Prevent gap between adjecent quads file://orthographic
It's not really necessary to understand the specifics of what this does. You just need to plug in the appropriate values in the correct locations.
Put the three camera coordinates found earlier into the ".vaxis_rotate(<X,Y,Z>.." construct.
Put the three coordinates where you want the camera to point into the "look_at<X,Y,Z>" construct.
Now, save the file and do a test run. The procedure can be repeated over and over to refine the shot or to create new ones. It is not necessary to re-run the model through L3P each time. Just change the coordinates in the final POV-RAY file and re-run.
It is possible to simulate just about any camera lens. The zoom of the lens is controlled by the "angle" construct (see above). L3P generates a standard view with this set to about 64. A telephoto lens (close-up shot) is simulated by a value of about 40. A wide-angle shot is simulated by a value of 100. Setting this to about 120 provides a super-wide-angle shot with some "fish-eye" effect.\
Doing a Photo Shoot
When doing many shots, it is often nice to save the camera positions. This is useful because you may want to enhance the model and then re-run the same series of shots. To do this, copy the above snippet from the POV-RAY file into a text file using notepad, Word, or any other editor. You can comment your shot by adding a line prior to it that starts with "//" (slash-slash). Then, when you want to re-run the shot, just copy the text from the text file and replace that text block in the POV-RAY file.
Questions or comments?
Brad can be contacted by email at
Brad Hamilton is a member of LUGOLA (LEGO Users Group of Los Angeles) and bases his LDraw models off of his real-life creations in BrickTopia.