In 1997 Quake II was released ending the Strogg's collective leader the Makron being killed. Quake III moves away from the Strogg, but the universe's worst cybernetic foes return in Quake IV, ready to be destroyed yet again by Earth's forces. Quake II left the Strogg home planet without its planetary defenses, leaving it open for your attack as part of Earth's new armada. You help deliver the final assault to the Strogg as Matthew Kane, member of an elite squad fighting along squadmates with vehicles and advanced weaponary. Quake IV is based on the Doom III engine, although it is apparent that Quake IV will be a superior modding platform thanks to iD and Raven's efforts in optimizing the netcode, adding vehicles, and general fixes made to the engine since Doom III's release.

Post tutorial Report RSS How to import static meshes into Quake 4 using Blender

This is a tutorial on how to import custom static meshes into Quake 4.

Posted by on - Intermediate Props Modelling

If you wish to discuss modding Quake 4 or any other Id Tech 4 based game I recommend joining the Id Tech 4 discord here.

Introduction

Quake 4 was developed by Raven software and runs on Id Software's Id Tech 4 engine. It was made concurrently with Doom 3 and runs on virtually the same tech under the hood. As a result most of this tutorial will apply to other Id Tech 4 based games such as Doom 3 and Prey 2006.

This tutorial will go over how to import a custom static mesh. Which you can use to make props for the environment. Both static and physics based. This tutorial was created in cooperation with Valkyries733 who provided the screenshots and tools needed to get this to work. Many thanks go out to him.

What you will need

  1. Blender
  2. Blender LWO importer script
  3. Blender LWO exporter script

Installing the plugins

First, install the import script by installing from the zip. The exporter script may be a bit complicated to extract. Just right click the link and press "save link as" then save it as a .py script somewhere.

Screenshot 2023 11 07 212120


Then install it like you would have the zip just point it at the .py script. You should now see both Lightwave scripts installed in Blender.

Screenshot 2023 11 07 212317


You now have both Lightwave plugins successfully installed.

Importing a Quake 4 static model

First we're going to import a Quake 4 static mesh. This will make the job much easier all around. But first we'll need to extract some files from the game's pk4 files. These can thankfully be opened/extracted using 7zip. For the purposes of this tutorial we're going to use crate1.lwo. Which is located in pak004.pk4\models\mapobjects\marine\equipment\crates\

Screenshot 2023 11 07 213505


Next import it using the importer plugin.

Screenshot 2023 11 07 213652


Once the model is imported, you may notice that it has a basic model overlaid onto it. This is the collision model, do not delete it.

Screenshot 2023 11 07 213848


Instead use the "P" key while in edit mode to separate the model by materials.

Screenshot 2023 11 07 214227


The collision model will always use a separate material The collision model does exactly what it sounds like it does, it's the collision mesh used for the lwo.

Once they're separated, before you get started you're going to want to make sure both of the UV names are consistent. By default blender uses the uv name of "UVMap". So we're going to go with that. The reason why we rename this is not only for consistency, but also because if a LWO has multiple UV Names the UV will break. If your model in-game looks like camouflage from hell, it's likely because you have multiple UV names.

4 1


5 1


Here you can see both the model and collision mesh have the same UVMap name.

From here, let's hide the collision mesh so we can properly see what our model looks like. You can quickly do this by pressing "h" while in object mode. Everything can be unhidden by using "ALT H" (edited)

Screenshot 2023 11 07 214354


Importing the new model

Now you can import the model you're going to be replacing it with, you're going to want the replacement model to be about the same size. If the replacement model is too big or small, it might look off when the model is placed in certain levels.

6 1


Get the models lined up nicely

7 1


Next we'll need to change the material name for the new object. It must point to a material located in the game's folder. Either the pk4 files or within the game directory.

9 1


The replacement model material name will likely be something like this, or could be something completely different. Regardless we're going to want to rename it to be consistent with the way Doom 3/Quake 4 handles it's material names Here is what the material name for the default quake 4 crate is, you can use this material name if you really want to and just replace the textures related to it or just make a new material. For the sake of this tutorial and organization I'm going to make a new material name.

Screenshot 2023 11 07 214839


So here's my material name, it's distinct, easy to remember, etc. Now we can delete the original Quake 4 crate as it's no longer needed.

11 1


We can also unhide the original collision mesh.

13 1


Combine the collision mesh with the new mesh. You have to do this so that upon export it exports both properly. You may notice that the smoothing groups/normals on the new model may become flat when combined. This is because by default the collision mesh has an "edge split" modifier. Go ahead and remove that to get proper smoothing groups.

Screenshot 2023 11 07 215244


Exporting the model

Now we're ready to export. Go ahead and export it as a LWO. If you're doing this as a new model entirely then you can put it anywhere under the models folder. If it's a replacement model you're going to want it to have the same exact model path as the original model since it's literally replacing the original file.

14 1

It needs to be the same model path, and the same model name to properly replace the model. Note the circle on the right side. This is a list of options you can toggle on when exporting. I wouldn't be too concerned with fiddling with most of the options. You Need to have "ID Tech Compatible" toggled on for it to work. If you're in doubt, just use the settings I'm using in this screenshot.

Now it's time to set up the material, materials are located within .mtr files. .MTR files are just renamed .txt files. You can open them by renaming them to txt or by using notepad ++. Either/or

15 1

image


I made a new .mtr file specifically for props.

16

Here's the inside of my MTR file, this is where the material is defined. This .mtr file defines what textures each material uses, and other flags the material might have. The original quake 4 or doom 3 mtr files are a great reference point when seeing what you can do with materials.

Note the material name, you're going to want this to be the same as the material name you defined earlier while in blender

image 1


image 2


Now the material is defined, from here you want to define the file paths for your diffuse, specular, and normal map

image 3


It's worth noting that you don't need all of these. You generally want a diffuse texture for obvious reasons. But you don't always need a normal map or specular map (although without them, you're texture might not look as good)

17


Here's the textures I assigned in the material, same file path and texture names. You can name these whatever you want, they just need to be the same as the names defined in the material

Now let's go in-game and see how it looks

18


There it is! The new models are replacing the quake 4 models. Basically a model version of a reskin.

Troubleshooting

If you look closely you may note 2 things:

1. It's a bit shiny

If it's a bit too shiny for your tastes, you can easily use a program like GIMP or Photoshop to lower the brightness of your specular mask. The Specular mask controls how bright the phong on the texture will appear.

2. Some parts of the texture on the model are stretching

EDIT: 12/12/2023 - There is a simpler fix to this issue. Just remove "clamp" from the Material file. That appears to fix the UV issue. The previously mentioned fix is bellow.

19

This is commonly caused by a UV island on the new model being outside of the UV square. Back to blender, if you open the UV editor you can see a layout of the models UVs

20

The highlighted area is outside of the UV square, LWOs don't like this. So you're going to want to line it back up within the UV square.

21

Lined back up, sometimes this is a 2 second fix. Other times it may require a bit more searching to find where the island should go within the square. Once it's fixed. Export the model again. If you want to see how the model looks without restarting your game you can use the console command "reloadmodels" to reload all of the models currently rendered.

22

And there you go, it's not as bright and the stretched texture portions on the model are fixed. And that's basically it. If you want to import a completely custom model and not just replace a model it's the same exact steps, just without importing the original quake 4 model as reference

Conclusion

Now you know how to import a custom static mesh. There is now a sequel to this tutorial going over how to make custom rigged meshes using .md5. It is located here.

If you wish to discuss modding Quake 4 or any other Id Tech 4 based game I recommend joining the Id Tech 4 discord here.

Post comment Comments
LithTechGuru Author
LithTechGuru - - 408 comments

Update March 2024. The LWO Exporter links are now dead. However I had the foresight to archive them via archive.org. So the link has now been amended.

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: