CLINTON'S
Lightwave 3D Plugins
home      
md5mesh import to Doom3
lost ball in the game
lostBall in the game
 
This tutorial will show how to take an md5mesh and it's textures into the doom3 game engine.  The lostBall object is based on the lostsoul flying demon and uses the built in animations made for the lostsoul demon.
 
Preparation
  Install doom3 to a non-default directory with no spaces in the name and no capitalization.  Use "c:\doom3" instead of the default of "c:\Program Files\Doom 3".  This advice is from the iddev website.
  folder structure
  Create a directory in doom3 "c:\doom3\mymod".  "mymod" is the name I chose.  Inside that create folders maps, models, textures, def and materials.  I have a capitol letter in "Doom3" so I broke one rule and I'm not really sure how important the rules are.
  Create a text file, "description.txt" inside mymod with a single line of text which will be the title shown in the mod selection screen.  Right click the file and send it to a zip archive.  Rename the archive from "description.zip" to "description.pk4".
  editor icon
  Copy the doom3 shortcut and rename it "doom3 editor".  Right click and change target to "C:\Doom3\Doom3.exe +set r_fullscreen 0 +editor +set fs_game mymod".  This sets the doom3 to run in a window instead of full screen, startup in the editor and set it to use the mymod folder.
Copy and Create the support files
  Copy "lostBall.md5mesh" to the models folder under "c:\doom3\mymod". 
  Copy "lostBall_d.tga" and "lostBall_ed.tga" into the textures folder.
  Create a text file called "lostBall.def" in the def folder.
  Create a text file called "lostBallTex.mtr" in the materials folder.
   
   
Edit the def file
  The definition file, "lostBall.def"  is a modified version of the "monster_flying_lostsoul.def".  It uses the model and entityDef sections.  Copy these sections to the lostBall.def file.  The model section defines the mesh and animations used by the character.  The entityDef tells doom to use the model defined in the model section, the behavior(ai) script that controls the actions of the character and other things that I'm not familiar with.
  model monster_flying_lostsoul { mesh models/md5/monsters/lostsoul/lostsoul.md5mesh


is changed to

model monster_flying_lostBall { mesh "models/lostBall.md5mesh"
  entityDef monster_flying_lostsoul {    "inherit" "monster_default"
.
"model" "monster_flying_lostsoul"

is changed to

entityDef monster_flying_lostBall {    "inherit" "monster_flying_lostsoul"
.
"model" "monster_flying_lostBall"
  Changing the inherit to monster_flying_lostsoul is the same as typing everything inside the monstor_flying_lostsoul entityDef.  The model line overrides the model value in the original inherited model.  So the final look of the entityDef is

entityDef monster_flying_lostBall {
"inherit" "monster_flying_lostsoul"
"model" "monster_flying_lostBall"
}
  Click here to download a copy of the final def file.
   
   
Edit the Material file
  The material file tells doom how to apply the tga texture files to the model.  The lostBall uses the same teeth mesh as defined in the lostsoul.  The material names are taken from lightwaves surface names.  They can also be seen by looking at the md5mesh file with a text editor.  The lines that start with "shader" indicate the names used.
shader "lostteeth_01S"
shader "lostBallS"
shader "lostBallFXS"


The simple materials have 4 basic elements:

qer_editorimage = image for use in the editor
bumpmap = height and normal map displacements
diffusemap = color
specularmap = shininess map

  Open the monster.mtr file and find the "models/monsters/lost/lost_teeth" section.  This was the original name of the shader in the lostsoul file.  Copy this section in to the lostBallTex.mtr  The other 2 materials are created by hand.
  change models/monsters/lost/lost_teeth to lostteeth_01S

this will tell the teeth to use the same material setup as in the lostsoul character
  Simple diffuse materials will be defined for the main lostBall and it's special effects "hair".  "lostBallFXS" can be compared to the original "models/monsters/lost/lostfx" and "lostBallS" compare to original "models/monsters/lost/lost ".  The materials used here are much simpler and less sophisticated than the originals.  There are no specular, bump or transparency used.
  lostBallS
{
diffusemap textures/lostBall_d.tga
qer_editorimage textures/lostBall_ed.tga
}

lostBallFXS
{
diffusemap models/monsters/lost/lostfx.tga
}
  click here to see the final material file
Add a new monster to your level
  The md5mesh and textures have been put in place and the def and material files typed up.  The next step is to start the editor and add the monster to a map. 
  Run the doom3 editor using the shortcut and load your map.
  Right click in top view choose monster, monster_flying_lostball
I believe the name comes from the entityDef.
Position the lostBall and save the map.  My map was saved as "mylost"
  Choose bsp, bsp from the menu to build the bsp.
  Click the play button on the upper far right.
  ctrl-alt-~
  type "map mylost" without the quotes
  the flaming lostBall will scream and attack after it sees you
  when done playing ctrl-alt-~ and type quit to get back to the editor
 
 
(mainSection)