Tools to Save Your MindStorm Models
Pages: 1, 2, 3
The next generation: MLCAD
Now let's look at the next step beyond LEdit. I like to use a Windows program called MLCAD. (There are other options, but this is the one I know about.) The bottom line is that MLCAD is a souped-up DAT or MPD file editor. But you can also think of it as a specialized computer-aided design (CAD) tool. MLCAD shows several different models at once and lets you move pieces around using the mouse. It also shows a portion of the DAT or MPD file you're working on and provides palettes of bricks to make it easy to find the right piece.
![]() |
Figure 4. The same Minerva arm model in MLCAD, a Windows DAT/MPD file editor. (click on image to view full size) |
Using MLCAD, you can build complex models quickly. It gets a little sluggish after you've added a lot of pieces, but it's still usable.
Important Glue: l3p
LDraw and MLCAD can display models, but the image quality is not great. To generate professional-looking images, like the ones in the official Lego instructions, you'll need to use POV-Ray, a raytracer. This is a program that can create highly realistic computer-generated scenes.The gap between the world of DAT files and the world of POV-Ray is filled by a little DOS utility called l3p, developed by Lars Hassing. The usage is pretty simple: Just supply a DAT file and l3p creates a POV-Ray file for you. For example, the two-brick model we looked at before can be converted like this:
l3p simple.dat
l3p will chug a little and create a simple.pov file which can be
immediately rendered in POV-Ray.
There are a couple of things you should know about l3p. First, it can only deal with eight-character filenames. Second, there are a couple of command-line options that I find useful. The -b option allows you to specify a background color (as red, green, and blue components) for the model. I usually use white, like this:
l3p -b1,1,1 simple.dat
Finally, the -o option specifies that if the POV-Ray file already exists,
it should be overwritten:
l3p -b1,1,1 -o simple.dat
POV-Ray
To create a scene in POV-Ray, just load the .pov file. It will show
up in POV-Ray's text editor. You can choose an image size from the drop-down
list on the toolbar. Then click the Run button and sit back while
your scene is drawn.
POV-Ray has its own language for describing scenes and how they should be drawn. Without knowing the entire language, there are some things you can tweak. The camera angle and the lighting are the most important adjustments.
The camera angle is defined in a block near the end of the .pov
file generated by l3p. Here's a typical example:
camera {
#declare PCT = 0; // Percentage further away
#declare STEREO = 0; // Normal view
//#declare STEREO = degrees(atan2(1,12))/2; // Left view
//#declare STEREO = -degrees(atan2(1,12))/2; // Right view
location vaxis_rotate(<55.3377,-33.905,-43.7907> +
PCT/100.0*<44.4925,-36.328,-44.4925>,
<-1616.32,-3959.17,1616.32>,STEREO)
sky -y
right -4/3*x
look_at <10.8452,2.423,0.701839>
angle 67.3801
//orthographic
}
Perspective
The default view is a perspective view, which ends up looking like this:
|
Figure 5. Default, perspective view of the two bricks shown in Figure 3. |
This is not really what we want for the building instructions. Instead,
I use something called an orthographic view. It's not as realistic,
but it shows the same piece the same size in different places in the model.
In general, it's easier to interpret for building models than a perspective
view. (Official Lego instructions use an orthographic view.) To see the
orthographic view, just uncomment the orthographic keyword by
removing the two slashes from its front:
camera {
#declare PCT = 0; // Percentage further away
#declare STEREO = 0; // Normal view
//#declare STEREO = degrees(atan2(1,12))/2; // Left view
//#declare STEREO = -degrees(atan2(1,12))/2; // Right view
location vaxis_rotate(<55.3377,-33.905,-43.7907> +
PCT/100.0*<44.4925,-36.328,-44.4925>,
<-1616.32,-3959.17,1616.32>,STEREO)
sky -y
right -4/3*x
look_at <10.8452,2.423,0.701839>
angle 67.3801
orthographic
}
Now our model looks like this:
|
Figure 6. Orthographic view of the same two bricks. |
Camera position
![]() |
Figure 7. Same model after substituting straight coordinates for vaxis data. Bricks appear too far away (small). |
Now we need to monkey with the camera angle so we can see the whole model.
The two things we want to change are the location and look_at
keywords. l3p automatically sets up look_at to point at the center of your
model, so you don't usually need to adjust it drastically. I don't really
understand the vaxis_rotate stuff that l3p puts in for location,
so I generally take it out and substitute straight coordinates, like this:
camera {
location <100, -100, -100>
sky -y
right -4/3*x
look_at <10, 0, 0>
angle 67.3801
orthographic
}
This produces the output in Figure 7.
Usually I adjust the location and look_at numbers
by trial and error until the model is framed well and displayed at an angle
I like. While you're adjusting these things, you should use a small image
size setting in POV-Ray so it doesn't take forever to render each frame.
To really speed things up while you're fiddling with the camera angle,
you might consider changing the QUAL setting at the very beginning
of the
.pov file you're working on. Setting QUAL to 0 displays
every brick as its bounding box, which makes rendering very fast.
![]() |
Figure 8. Same model after changing camera location to bring model "closer." |
The above model is too far away, so I will adjust the camera location vector by multiplying it with a scalar. This moves the camera closer or farther from the model without changing any of the angles.
camera {
location .6 * <100, -100, -100>
sky -y
right -4/3*x
look_at <10, 0, 0>
angle 67.3801
orthographic
}
The results (Figure 8) are satisfactory.
Lighting
Once you've got the camera angle just the way you want it, it's time to start playing with the lights. In the image above, the lighting is not very good. The forward face of the black brick is not lighted well; it's hard to see the hole. Worse than that, however, there are too many shadows. For building instructions, we want the lighting to be very simple.
l3p creates three lights in your .pov file. These are specified
just after the camera section, and look something like this:
light_source {
<0,-61.3755,-51.3755> // Latitude,Longitude,Radius: 45,0,72.656
color rgb <1,1,1>
}
light_source {
<54.492,-46.328,31.461> // Latitude,Longitude,Radius: 30,120,72.656
color rgb <1,1,1>
}
light_source {
<-31.461,-72.9219,18.164> // Latitude,Longitude,Radius: 60,-120,72.656
color rgb <1,1,1>
}
![]() |
Figure 9. Same model after repositioning lights. |
Basically all you need to do is move the lights until your model is lighted
the way you want. Here I've moved them so there's one in front of the
model, one on the front side, and one behind and above the hole in the
black brick. The shadowless keyword is used to specify a light
source that illuminates but casts no shadows.
light_source {
<25,-100,-50>
color rgb <1,1,1>
}
light_source {
<-50,-50,-50>
color rgb <1,1,1>
shadowless
}
light_source {
<10,-25,25>
color rgb <1,1,1>
shadowless
}
Figure 9 shows the result of the new lighting.
Lighting is tricky. You will need to practice for a while until you get things the way you want them.







