ookay, some of you are ready aware of it but I started a tutorial on how I put my character into doom3, calculated the normal maps with the d3 engines and such.
so there we go, part 1 : setting up and creating normal maps for your model (character or not) for doom3
<u>
Introduction: </u>
Welcome in my first tutorial ever. This is a step-by-step tutorial explaining the set up and the various commands and restrictions needed to create a plug-in player model for the game Doom 3 (ID Software/Activision). I assume you already know how to create a high poly and a low poly model and that you know the rigging/skinning basics in 3D studio max. I also assume that you ALREADY have a model ready and with proportions matching the mpplayer.md5mesh (this is important as this tutorial uses skeletal animations)
<u>
Step 1: Rendering normal maps:</u>
If you want to make a model for Doom3, you need normal maps to be applied to it so the engine can fake the highly detailed stuff in order to do that you have several options:
· ORB - Open-source Render Bump : a pretty good and fast normal map renderer, pretty easy to use and with a pretty good output result.
· ATI Normal mapper : I used to prefer that one to ORB, though youll need to invert the green channel of the output map, it also renders the occlusion term , has a very good output result and a lot of cool options.
· Doom 3 built-in renderbump/renderbumpflat tool : to me the best and fastest one, the map will be a little different than in the two previous tools, showing a few artefacts but the bump will look a lot better once in-game this is the option well choose in this tutorial.
A the material File (*.mtr)
The first step is to open you Doom3 base directory and find the materials directory in this directory, create a blank .txt file that youll name after your characters name for instance. In this *.mtr file youll need to make a few things:
* Define a shader name, in this example:
models/characters/players_mp/mp_male2
This is the name the game will look after when trying to texture your model, the same name that will be needed as material name on your object.
* Then you will need to define the properties of your surface, for more properties look into the *.mtr files present in the game. This is what I wrote :
noselfShadow
unsmoothedTangents
collision
forceOverlays
they are self-explanatory, you could also add :
noshadows for a model that wont cast shadows,
transluscent for a transparent model (used on the mask of the spaceman)
* Now, we will give the engine the different parameters for normal map rendering:
renderbump -size 1024 1024 -trace 0.07 -colorMap -aa 2 models/characters/players_mp/mp_male2_local.tga models/characters/players_mp/mp_male2_hi.lwo
- renderbump is the command youll use in the console
- -size 1024 1024 is the size width height of your normal map
- -trace 0.07 the tolerance or ray hit distance. The smaller, the more precise it is, but the less tolerant
- - aa 2 is the anti aliasing factor here , 2 samples per texel
- models/characters/players_mp/mp_male2_local.tga is the path to your normal map file, this is where the engine will create it.
- Models/characters/players_mp/mp_male2_hi.lwo is the path to your highpoly model. You may notice that the path is always the same as the shader name, I did this by convention, as ID seemed to respect this for all their shaders
* now we will define all the other parameters of the shader (diffuse, specular, bump, special effects)
diffusemap models/characters/players_mp/mp_male2.tga
{
blend bumpmap
map addnormals(models/characters/players_mp/mp_male2_local.tga, heightmap(models/characters/players_mp/mp_male2_h.tga, 3 ) )
// note that you do NOT put vertexColor on the bumpmap
}
specularmap models/characters/players_mp/mp_male2_s.tga
- diffusemap models/characters/players_mp/mp_male2.tga is the path to the color map that will be applied to your model
- blend bumpmap
map addnormals(models/characters/players_mp/mp_male2_local.tga, heightmap(models/characters/players_mp/mp_male2_h.tga, 3 ) ) This blends both the normal map and the bump/heightmap to create the final bump shader that will be applied to the model. 3 is the strength of the blend I think (to be checked).
- specularmap models/characters/players_mp/mp_male2_s.tga is the path to the specular map
you can check the *.mtr file joined with this tutorial for more information.
Once your file is done, save it as a *.mtr file
B setting up the model in lightwave
Both your high poly and low poly models have to be saved as *.lwo objects with smoothed normals (no smoothing groups, at least for the low poly mesh, I tend to use smoothing groups for the high poly mesh though, especially for small details). The low poly model needs to be UV mapped with as few seams and distortion as possible, though, distortion is really hard to avoid on normal mapped objects and you can be sure that youll need to make a Photoshop phase before using your normal map into doom3.
· Import your low poly mesh into lightwave (I created the models in Maya so I exported them as *.obj files)
· Open the surface editor and give your model the right shaders, for me the body needed the models/characters/players_mp/mp_male2 shader. The shader is the one you created with the *.mtr file.
· Also give the surface a 180° smooth
· Save your model in the folder your shader will be looking in (so for me that was models/characters/players_mp/) as a *_low.lwo object (mine was mp_male2_low.lwo)
· Import your high poly mesh into lightwave as a new object.
· Smooth the normals (via the surface editor) to 180°
· Save your model as a hi.lwo object in the same folder as your low poly mesh and with the same name as defined in the * .mtr file (so for me: mpmale2_hi.lwo)
C Rendering the normal maps into the Doom 3 engine
Check
· that your paths are correct in your .mtr files
· that BOTH your models are triangulated and smoothed correctly
Launch Doom3 once the game loaded, bring down the console (ctrl+alt+tilde) and type :
renderbump yourlowpolymodelpath.
For me that was :
renderbump models/characters/players_mp/mp_male2_low.lwo
the engine will search for the shader applied to your low poly model and will look into the *.mtr files once found it will start rendering the normals. The screen will be inverted; this is due to the way the engine calculates the normals, with the Y axis pointing downwards.
LEGAL STUFF : please be kind and don't distribute this tuto anywhere else than these boards, this is still wip and I'll make sure everyone can access it once finished - thanks
hope this will be useful
thanks to :
Chunkey, Earthquake, Chico for tests
ID software for their game
if I'm wrong somewhere, please tell me, I'll modify this
Replies
thanks very much man.
Per, thanks for the hint.
ok, can't edit the first post, so here's the link to the first version of the *finished* tutorial :
http://wip.global-illusions.com/d3tut/quick%20Tutorial%20-%20Doom3_PPM.htm
feel free to tell me if anything's wrong.
EDIT: Fuck, beat....
Nice tutorial. So the models *have* to be .lwo format? That is kind of stinky. There probably isn't any plug-ins for max or Maya that export to that either, is there? It's the native Lightwave format, right?
oh yah and the position on the shot isn't my fault, I'm using doom3 anims
A thing that confuses me: You change the entity name in your mp.def, how does the game know you changed it? In the code it asks for the doommarine_mp, does it somehow search the entity? Or did you change that while writing the tutorial without testing it?
And I'd suggest linking to the iddevnet.com site (subsection materials) instead of doom3world for the shaders, it's MUCH more useful, at leat at the moment.
the entity is defined in the mp.def, doom3 looks here to know which one it will be.
and yah I tested it, I did this tutorial 2 months after importing and playtesting the spaceman ingame