Weapons tutorial 2 - UVW Mapping

In this tutorial we will modify an existing 3D model to get mappingcoordinates of the model.
These coordinates are needed for skinning the model. This tutorial will also show how to 
export the 3D Max file, and import the model into Quake III.

Following applications will be used in this tutorial:

3D Studio Max
(Sorry, no download available)

Texporter PlugIn for 3D Max 
For 3D Max 2.x: http://www.cuneytozdas.com/software/max/texporter/texporter2.zip
For 3D Max 3.x: http://www.cuneytozdas.com/software/max/texporter/Texporter3_2f.zip

Pop'n Fresh PlugIn for 3D Max 
http://www.quake3mods.net/md3centre/md3centrefiles/Pop_n_Plugs.zip

MD3 Viewer
http://www.quake3mods.net/md3centre/md3centrefiles/nmd3c.zip

Quake III
(Once again no download available)

Preparations
If you made your model like shown in our first tutorial you don't need this step.

Create a directory with the following structure:

/models/weapons2/shotgun

Copy your .max file in this directory.

1. Check your model

This step is very important. If you don't check your model, some ugyl graphic-errors may occur later in the game.

Select the model, and choose Modificators -> More ->  STL-Check. Choose the option all and check the modelfor errors. 
If everything is correct, save your model.

2. Splitting up the mesh

Click on Configure -> Configure Viewports and select Edged Faces. Now choose the modifier Edit Mesh and select the Subobject Face. Take a look of your model and find out which faces ouch each other in way you can detach them together. Now select these faces and click on Detach. Repeat this step until you have detached all face, and make sure you didn't forget any part. Depending on the complexity of your model this step is very time-intensive.

3. Attach the faces back together

Select one of the just detached faces, click on Edit Mesh -> Attach List and put all the objects 
back together. Yes, this must be done, also if it seems to be useless work.

4. Make a clone (IMPORTANT!)

If you don't make a clone of your model now, all the next steps will be useless. Click on
Modify -> Cone
and choose Copy. Move the clone out of the viewport, so it doesn't annoy you
while working.

5. Move and rotate the faces

Now we need to arrange all objects to face the viewport. For this step I prefer the the sideview. Depending on the compexity of your model this step can be very time-intesive, because not all objects are at a 90° angle to the chosen viewport.
Select the model and choose the modifier Edit Mesh with the Subobject Object. Now select one of the just detached face-objects. Those objects can be rotated, moved and scaled, but the proportions should not be changed. You must not add or delete any faces.
If you want to paint the same part of the skin on several faces, you are allowed to move those face over each other.

Now that all objects face the same direction, we must arrange them in a square.  The smaller the square is, the more detailed your skin will be.

6. Applying the UVW Map

Select the model and use the Modifier UVW-Map. Make sure, you have selected the right axis. If the axis is correct, press Fit and you just created  some mappingcoordinates on your model.

7. Morph the objekt 

Select the model and click on Create -> Compound Objects -> Morph and pick the clone you made in step 4 as Target. Now the objects morphs back into the original shape again. Now you can delete the clone, we don't need it anymore.

8. Create and export the skin

Go in the Utilities menu and choose More -> Texporter. Set the image size to 256x256 pixels and make some personal tweaking. Now press Pick Object and select your model. Now a basic skin with the mesh's edges will be generated. Save this file as .tga image.

9. Melt the model's vertices

Go back to the Edit Mesh modifier and choose Vertex. Select all vertices and press Melt Vertices. Make a STL-Check again and there shouldn't be anny errors. If there are any errors you have to move and melt the specific vertices, until all errors are fixed.



10. Create and apply the material

Change to the Material-Editor, choose a material an click on Maps. Create a map of the type Bitmap. Load the .tga file you have just exported.
Make sure you have selected the little blue-white cube and drag the material on the model. If you render the scene now you will see, that the lines of the skin lay on the edges of the model.

11. Align the model


Before we can export the model, we import one of the Quake weapons into our scene. Click on File -> Import and choose the filetype .md3. Scale your gun until you're satisfied. Now rotate your model until the barrel point to the same direction like the Quake model.

Now click on Edit -> Select by Name and choose all objects but tag_weapon, tag_flash and your gun. Delete these objects. Align the  tag_weapon object to your weapon's handle, and the tag_flash object to the front of the barrel. Both objects must point into the shooting direction of your gun.

12. Exporti the model

Click on File -> Export and choose the filetype .md3. Enter the filename and export frame 0.
With the MD3 Viewer you can preview your model and check if ther are any errors. Just load the .md3 file and take a look on it.

13. Compile the model

Start NPherno's MD3 Compiler, choose Import Objects, pick the .md3 file and import all objects. Now click on Rebuilt Normals and confirm. after that you export your object again. 
Compiled objects can not be shown by the MD3 Viewer anymore.

14. Import the model into Quake

Copy the .md3 file and the skin in the directory  ..\quake\baseq\models\weapons2\shotgun.
Rename your .md3 file into shotgun.md3. 
Now start Quake, and you will see your model instead of the shotgun.

After we imported or model successful into Quake there's only one thing missing: a realistic 
skin! We will fix this in our next tutorial at http://www.planetquake.com/caphold/tutorials.html.

f you have any questions, comments or anything else considering this tutorial, don't e-mail me.
I won't answer any mails. Please post in our forum, because others can read this stuff there too. http://www.planetquake.com/caphold/forum.html

This files can be used, copied and edited for private use only. Redistribution, only with our permission.

(c) 2000 - Capture 'n Hold Team

Downloaded from: http://www.planetquake.com/caphold

Written by: Pearl Silva