PDA

View Full Version : WIP Polycount Tutorial - creating a PPM for doom3


vahl
11-01-2004, 06:05 PM
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 you’ll 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 we’ll 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 you’ll name after your character’s name for instance. In this *.mtr file you’ll 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 won’t 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 you’ll 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 you’ll 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 /images/graemlins/smile.gif

vahl
11-01-2004, 06:24 PM
as a reminder, here's an ingame shot of the spaceman (tested online, say hello to chunkey, holding his nice rocket launcher !!! /images/graemlins/laugh.gif)

http://wip.global-illusions.com/D3spaceman/spaceman_ingame06.jpg

Sean McBride
11-01-2004, 07:33 PM
nice tut vahl /images/graemlins/laugh.gif Extreamly nice model, although in that stance he looks a little like he has to pee :O

Thermidor
11-02-2004, 03:41 AM
im gona be coming back here again and again , im sure ..

Jes
11-02-2004, 05:05 AM
Now this is a nice tut! /images/graemlins/smile.gif

RazorBladder
11-02-2004, 09:27 AM
nice to see some in-depth tuts for custom Doom 3 material.

John Warner
11-02-2004, 10:23 AM
from now on, when people ask me why i love you, Vahl, (which they often do) i'll direct them to this thred.

thanks very much man.

perna
11-03-2004, 03:17 PM
Good stuff here, vahl. Some feedback:

I don't know if everybody will think the unsmoothedTangents, collision and forceOverlays keywords are self-explanatory /images/graemlins/smile.gif

aa 2 = 16 samples. aa 1 = 4 samples

You might be a bit unclear on how to give an object a material. I don't know how LW works like that, but it sounds like you're saying to apply the d3 shader to your model in LW. Actually D3 determines the name of the shader to apply by first finding an instance of "base" or your mod name in the path, then stripping it of extension. This means you can apply an objects diffuse texture as a material in max/maya/lw and it will be read correctly by doom.

You might want to add that Max users can export ASE files. D3 reads them as it does LWO.

vahl
12-14-2004, 07:44 PM
thanks all for the good words
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.

adam
12-14-2004, 10:15 PM
Although lengthy, I'm glad tools like this are avaible. You've done that community a great service vahl. Really, good job man.

e_x
12-15-2004, 01:17 AM
Looks like he has to pee

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?

vahl
12-15-2004, 11:28 AM
yah this is the nativs lightwave format, though, as per noticed, the engine reads the .ase (from max) pretty well so you may be able to use this file format too.

oh yah and the position on the shot isn't my fault, I'm using doom3 anims

Skizot
12-27-2004, 09:50 AM
I see how it is... forget me and my help with all this importing crap huh...

Omar_Nabiev
12-28-2004, 08:23 AM
Excellent tut, thanks.

KDR_11k
01-08-2005, 04:04 AM
Sorry, late post here, just some stuff I noticed while writing the Doom 3 PPM support mod:

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.

vahl
02-09-2005, 01:29 PM
when I did this tutorial, iddevnet wasn't online

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

KDR_11k
02-10-2005, 08:54 AM
Hm, that's rather weird because the code doesn't show any signs of searching for an applicable class, it spawns a "doommarine_mp" entity.