|Design 1, Design 3 (Computer and Video Games)|
|Unit 14 - 4th January 2002|
Exporting an Animated Polarbear from Lightwave
If you are a Lightwave Modeler you will not be too glad about Dáire Stockdale's exporter and might look for something else. There is an old Lightwave to Unreal Saver written by a guy called PantherD, which works well. The problem is that it only works with Lightwave' Layout programme version 5.5 or 5.6 and that it has to be treated with care in order to avoid crashes. Anyway, it works. And you can download it here.
The UnrealSaver plugin resides in the folder /plugins/Layout of your Lightwave folder. There is an ASCII file called unrealsaver.cfg which contains just one line of ASCII text, defining the path the UnrealSaver looks for the .lwo files and puts output into. Unfortunately you must strictly keep input and output files in that directory. UnrealSaver will otherwise crash withour warning and grace.
Let's suppose we have modeled a creature in Lightwave's Modeler.
Note that the polar bear on the right is not oriented as you would usually have it oriented. What is called "top view" in Lightwave shows a standing polar bear, and not one seen from above. This is because Unreal assumes quite unconventionally to be the z-axis the vertical axis. For Lightwave and most other 3D programmes the y-axis uses to be the vertical axis.
In Lightwave's File menu you will find the Export submenu and select "Export as Lightwave 5" and call the object "polar_1.lwo".
Now create a second object by modifying the first one (raise the paw, twist the neck, move the feet aso.) and save it as "polar_2.lwo".
Quit the Modeler and open Lightwave Layout version 5.5 or 5.6.
Import polar_1.lwo and polar_2.lwo and specify a metamorph between the two of them. You might use some 10 to 60 frames for the in-betweening which will finally then be the frames in Unreal.
Don't worry that the polar bear lies on its back. It will be upright after import into Unreal.
This is the tricky part now.
In Lightwaves objects panel you will find PantherD's Unreal Saver in the Displacement plugins, if you have properly installed it.
PantherD's saver operates
on metamorphs or other displacements by generating Unreal animation files
(with a *_a.3d extension) and mesh data files (with a *_d.3d extension)
whenever you press the blue "Options" button in the displacement
subpanel of the objects panel. If we would do this immediately after having
created the metamorph and before rendering all the frames first. The plugin
would tell us "Unreal binary anim 0 frames written". We have
to go through all the frames manually by pressing the single step forward
button on the lower edge of the Layout window untill we reached the last
frame of the animation.
PantherD's plugin created an Unreal Script file called polar_1.uc and the static mesh information in polar_1_d.3d and the animation data in polar_1_a.3d. The Script file has been manually edited to get the right name for the default movement - "Movement" in our case - and to adjust texture file names if one does not use the ones the plugin suggests automatically. (Remember that Unreal textures need to be .pcx or .bmp files with powers of 2 dimensions. .tga files or .tiffs won't work even if they are nicely displayed in Lightwave.)
class polar_1 expands Actor;
#exec MESH IMPORT
MESH=polar_1 ANIVFILE=MODELS\polar_1_a.3d DATAFILE=MODELS\polar_1_d.3d X=0 Y=0
#exec MESH ORIGIN MESH=polar_1 X=0 Y=0 Z=0
#exec MESH SEQUENCE MESH=polar_1 SEQ=All STARTFRAME=0 NUMFRAMES=30
#exec MESH SEQUENCE MESH=polar_1 SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=polar_1 SEQ=Movement STARTFRAME=0 NUMFRAMES=30
#exec TEXTURE IMPORT NAME=pbr1_rIris FILE=MODELS\pbr1_rIris.PCX GROUP="Skins"
#exec TEXTURE IMPORT NAME=pbr1_eye FILE=MODELS\pbr1_eye.PCX GROUP="Skins"
#exec TEXTURE IMPORT NAME=pbr1_body FILE=MODELS\pbr1_body.PCX GROUP="Skins"
#exec TEXTURE IMPORT NAME=pbr1_lIris FILE=MODELS\pbr1_lIris.PCX GROUP="Skins"
#exec MESHMAP SCALE MESHMAP=polar_1 X=0.5 Y=0.5 Z=1.0
#exec MESHMAP SETTEXTURE MESHMAP=polar_1 NUM=0 TEXTURE=pbr1_rIris
#exec MESHMAP SETTEXTURE MESHMAP=polar_1 NUM=1 TEXTURE=pbr1_eye
#exec MESHMAP SETTEXTURE MESHMAP=polar_1 NUM=2 TEXTURE=pbr1_body
#exec MESHMAP SETTEXTURE MESHMAP=polar_1 NUM=3 TEXTURE=pbr1_lIris
Auto State Movement
This is the time now, to recompile your classes and objects so that UnrealEd will be able to read the objects and allow you to place them in your scenes.
The last line, saying "Success ... " indicates that everything went fine. A new Unreal package file - in our case one called XtraLevel.u - has been generated in the system folder of UnrealTournament.