To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Jimmy Figiel / tutorials / animation1 / all


Creating Articulated Models

Table of Contents
View Entire Tutorial in a single page

Overview

Previous Next

This tutorial explains my methods for creating LDRAW animations using POVRAY. POVRAY can be a very complex program to use, especially when you want to do animations in it. I’ve found that it is easier to create animations if you break it into a two step process. The first part is to create models that are easy to pose and are separate from the main POVRAY file. The second part is to animate it. Creating this model will be the focus of this tutorial. Animating the model will be the focus of the next tutorial. The models created here don’t have to be used for animations. They can also be used to create POVRAY static scenes. The ability to pose the models easily greatly helps this process.

This tutorial assumes basic knowledge of how to use MLCAD, L3P and POVRAY.

Previous Next

Tools

Previous Next

Several tools are needed to create the model.
  • MLCAD (You Could Use LDRAW, I just find it easier to use MLCAD ). You can get the latest version from http://www.ldraw.org.
  • L3P - A program that coverts your LDR files into POVRAY. You can get the latest version from http://www.ldraw.org.
  • POVRAY - A free 3D graphics rendering package. You can get it at http://www.povray.org.
  • YABASIC - A free version of basic that integrates with windows well. You can get it at http://www.yabsic.de.
  • MakeModel.yab - My basic program that coverts the L3P output to a articulated POVRAY include file. This program is listed at the end of this tutorial.
Previous Next

Examine The Model

Previous Next

The first step in creating an articulated model is to examine the model that you are going to create and determine the parts that you want to articulate. For our example we will be using an existing Lego set 6581 Dig N’ Dump. More specifically, the dig part.



Building instruction can be obtained at http://www.brickshelf.com/scans/6000/6581/.

Step 1 is to identify the different parts that you would like to be able to move. Here is what I see.
  1. Wheels
  2. Chassis
  3. Cockpit
  4. Lower Arm
  5. Upper Arm
  6. Bucket
You could also animate the control levers, I choose not to for this tutorial.

Previous Next

Build Components

Previous Next

Now we need to build each of the parts of the model that we identified above, but we need to build them in a special way. The location of the part that will actually be doing the rotating must be placed at the origin (location 0,0,0). I do this by first placing a special model that I have built into the model at 0,0,0 for reference. The Model is called RotationPoint.ldr and can be found in the LDR File section below. Build the component around the RotationPoint element. You can leave the RotationPointElement in the model because it does not render in POVRAY. Here are images of each of the completed components. Each grouping has the front view, top view, side view, and perspective view. I left the RotationPoint element in so that you can see it. The complete files for each of them are in the LDR files section below.

Digger Bucket



Note that I rotated the bucket to be similar to the way it will be attached to the completed model. This helps later in the construction.

Digger Upper Arm



Digger Lower Arm



Note again that I rotated the arm to be similar to the way it will be attached to the completed model. This helps later in the construction.

Digger Cockpit



Digger Chassis



Digger Wheel



Previous Next

Combine Components

Previous Next

Now we are going to put all of the pieces together that we built in the last section. The key to assembling the pieces is to take note of what pieces move when another piece moves. For example, when the upper arm moves the bucket moves with it. When the lower arm moves, the upper arm and the bucket move with it. I call the end that does not move any other pieces (the bucket) the finger.

Start at the finger and connect the next level to it. In MLCAD, start a new model. Drop the digger bucket and the upper arm into the 3D view. This places them both with their origin (where we have the rotation point) at 0,0,0. Now move the finger (the bucket) to the place where it should connect to the upper arm. I like to have the pieces set up in thier defalt location, so I rotate the bucket around the Z axis until it is tucked right under the upper arm. Make sure that the rotation point setting in MLCAD is set to the part origin. This causes the piece to be rotated around where we put our rotation point.

Now we need to add a comment to the model that will specify that this connection will be articulated and name the connection. Add a comment to the model directly above the part that is going to move. The comment should say
Joint X bucket
This comment specifies that we are creating a bendable joint. The joint is going to bend around the X axis, and will be called bucket.

Make sure that you set the color of all the components to the main-color 16. If you don’t, there may be a problem with the way the sub part colors look in the rederd image.

Save this model as DiggerArticulatedUpperArm. Here is the complete listing of the piece. MLCAD adds the word WRITE in the comment.

0 Digger Articulated Upper Arm
0 Name: DiggerArticulatedUpperArm.ldr
0 Author: Jimmy Figiel
0 Unofficial Model
0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG -1 0
1 16 0 0 0 1 0 0 0 1 0 0 0 1 DiggerUpperArm.ldr
0 WRITE Joint X bucket
1 16 0 0 -100 1 0 0 0 -1 0 0 0 -1 DiggerBucket.ldr
0

This combined piece is now the finger for the next piece (the lower arm). Continue attaching all of the pieces until the model is built. The last piece (which I call digger chassis) has more than one finger attached to it. Each wheel is a finger. Since this connection is the last one, I simplified the name of the file to digger. I put a rotation point into digger to specify where the ground was and to specify where the rotation point of the entire model is when it is in a scene. Images of all the pieces are below. The ldraw files are in the ldraw files section below.

Digger Articulated Upper Arm



Digger Articulated Lower Arm



Digger Articulated Cockpit



Digger Articulated Chassis



Digger



Previous Next

Convert LDRAW File To POVRAY

Previous Next

Now lets convert this thing into a POVRAY file.Go to a DOS prompt and run the command

l3p digger.ldr

A file will be created named digger.ldr.pov . Rename the file digger.pov.Load this file into POVRAY and render the image. If everything was put together correctly, the image should look something like this.



Previous Next

Create Articulated POVRAY Include File

Previous Next

Now we get to create the file that will simplify our rendering lives. Run my program
makemodel.yab
When prompted for a file type in
digger
The program assumes that the file will end with .pov

It will create a file called digger.inc.

This file is all ready to use in static images and animations, and is completely posable!

Previous Next

Create Scene File

Previous Next

Now we are going to start using our files. You need to get a copy of my ldrawcam.inc to do this. You can get it from the POVRAY files section of the tutorial. Go into POVRAY and create a new file. Type in this...

#include "digger.inc"

digger(default_options)

#include "ldrawcam.inc"

TrackingCamera(<0,-90,-170>,350,45,13)

BlueBackground()

GreenFloor(0)

Light(<0,-280,-220>)
Light(<200,-220,80>)
Light(<-100,-300,30>)

We have now put a scene that normaly would take 3661 lines of POVRAY code in a file that has 9 lines of code in it. This size file is much easier to manage. We also can fully manipulate the model we built in this scene.

Lets go line by line through the POVRAY code
#include "digger.inc"
This line says to take the file that we created and include it in this file when we render.
digger(default_options)
This line says to call a macro (function) named digger. The call to the macro will create an instance of our model in the scene.This macro was generated by the program we ran in the last step. It will always have the name of the include file without the “.inc”. The default_options specifies that the model be set in its normal position.
#include "ldrawcam.inc"
This line says to include a file named ldrawcam.inc in our file. This file is one that I wrote to make life eaisier in POVRAY. It has several different kinds of cameras in it. It also contains some simple backgrounds and grounds that you can use in your scenes. The file listing is in the POVRAY files section of this tutorial.
TrackingCamera(<0,-90,-170>,350,45,13)
This line specifies a camera to use in the scene. The Tracking Camera is the one I use most. The first parameter <0,-90,-170> specifies the location that you want the camera to look at. It is in LDRAW units. The next parameter is the distance that you want the camera from this point. The third parameter is the rotation around the Y axis you want to look at the point from. The last parameter is the amount of tilt you want on the camera. I’ll talk about the other cameras when I do the rest of the animation tutorials.
BlueBackground()
This says to put a nice sky blue color in the background.
GreenFloor(0)
This says to put a nice green ground for my models to sit on. The parameter 0 specifies where along the Y axis you want the ground to be.
Light(<0,-280,-220>)
Light(<200,-220,80>)
Light(<-100,-300,30>)
These three lines specify to use three lights in the scene. Three helps light up things from all sides. The parameters specify the LDRAW location of the light <x,y,z>.

Save it to diggerscene.pov and render. Your image should look like this.



Now lets move our model. Each of the joint names that we specified in the comments of our ldraw models has become a function that we can use to move our model. The name of the function is the name of the model, an under score, and the name of the joint. Change the line
digger(default_options)
to
digger(digger_cockpit(45))
Now render the image. It should look like this. The cockpit of the digger is now rotated 45 degrees around the Y axis. A negative number will rotate it the other way.



If you want to adjust more than one thing at a time, you put all the functions together with plus signs. You can put them on multiple lines to make it more readable. Now change the line to
digger(digger_cockpit(45)+
       digger_lowerarm(-30)+
       digger_upperarm(90)+
       digger_bucket(135))
The image should now look like this.



If you made it this far you have come a long way. There is a lot of detail here. Take some time and move the model around and the camera around. Next time we will create a digger movie.

Previous Next

Primary content in this document is © Jimmy Figiel. All other text, images, or trademarks in this document are the intellectual property of their respective owners.


©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR