- Focusing the view on a selection in Blender 2.79 using View Selected, still available but now updated in Blender 2.8. In Blender View All still functions exactly the same way but is now called Frame All. In other words, when selecting the option everything in a Scene, including those off-screen, are pulled into view regardless as to.
- I have used Blender for seven years, in that time I have made five animations using the program. I have wanted to create an introductory series into Blender.
First Steps
In this chapter an overview of the addon, as well as an import and export example is given. If you work yourself through this chapter, you will have seen almost everything about the addon.
Overview
User preferences for 2.8 are now under the Edit Preferences menu, to the right of File menu. Saving and loading of settings has been moved into the Preferences window and is now done from a dedicated popup dialog, at the bottom left of the panel. Autosave is on by default, meaning that any changes should be saved automatically on (gracious.
The addon is located in a Panel called RtCW/ET in the View Properties of the 3D view port (shortcut 'N'). It will be available in Object Mode only.
There are 5 Sub-Panels: Import, Export, Direct Conversion, Attachment, Shading and Unzip PK3s. You can find more details about those panels in chapter Panel Description.
Additionally the addon prints verbose log output to the system console. It will print debug, info and warning messages. You can open the system console under Window - Toggle System Console.
In case the addon receives too many warnings, it will redirect you here.
Blender 2.8 Save User Preferences
Import of a Character
In this section we are going to import and assemble a game character from the game Wolfenstein: Enemy Territory. Game characters are made up of many different parts. The main parts are: body, head, helmet and accessoires like the backpack. These parts are stored in different model formats: MD3 or MDC for head, helmet or accessoire models; and MDS or MDM/MDX for the body models.
Preparations
Before we start we should do 2 things: 1) extract the game data from pk3 files and 2) find out where our different model parts are located on disk.
Extracting the game data
At some point in this example (during shading or attachment) the addon needs to have a reference to a directory which contains all the game data in uncompressed form. Game data for RtCW and W:ET is mostly located in compressed files whose names end with
.pk3.
We use the Unzip PK3s panel to extract all the .pk3 files from the game. See chapter Unzip PK3s for more details. For the input field called Source Filepath search for your W:ET installation path and choose the directory called
etmain. For the input field called Target Filepath create a new and empty folder and use this as input.
Make sure enough space is left on your disk, as the operation will require around 800MBs. Click the Unzip button and after some time your data will be extracted to your target folder. The operation will search the source directory and all its subdirectories recursively and extract all .pk3 files it finds to the target directory.
Finding the model parts
W:ET uses a system involving .char files to assemble its characters during runtime. The .char file for the allied engineer is located at:
characters/temperate/allied/engineer.char. The file content reveals some information:
The information is either directly containing a reference to the model files (see
meshor
hudheadkey) or it references other script files (for example
animationgroup). The picture above marks the information needed for the body model and the head model. That will be our starting point.
Importing the body
The body models in W:ET are stored in two seperate files. The mesh data for the body is located in .mdm files. The animation data is separated and stored in .mdx files. This way different meshes can reuse the same animation data. This is different compared to RtCW, as RtCW stores all its data for a body model in a single .mds file.
We already have the location of the body file for our allied engineer, but we still need to figure out where its animation data from the .mdx files is located. We can find this information by following the
animationgroupkey-value pair from the .char file. Opening the file located at
animations/human_base.animreveals many different .mdx locations for this character. We choose
body.mdxfor this example as it is basically the main animation file used by all 10 characters of the game.
Now we have all the file paths we need for the body part. All that is left to do is use the Import Panel of the addon to import the model. Chapter Import has more details on this panel. After you located the panel in Blender, use the combo box called
Formatto choose the MDM/MDX file format.
For the input field called
MDM Filepathchoose its absolute path. For the input field called
MDX Filepathchoose its absolute path. Lastly, choose frame 32 for the input field called
Bindpose Frame. This frame influences the edit mode mesh, which is bound to the skeleton. Johnston sweepers c201 manual. This is kind of a magic number. The models shipped with the game usually have many different frames representing the bind pose.
Your input fields should look similar to the picture above. Click the Import Button and after around 5 to 10 seconds (it is alot of data) your body model will be placed inside a collection in Blender. Make sure you have around 150 MB space left on disk, as the .blend files get rather large if you save them.
Importing and attaching the head
From chapter Finding the model parts we know the location of our head model. Let's fill in the data into the import panel for the MD3 format. This works the same as in the previous chapter. After import the head model will be placed into a separate collection.
For attachment of the head model to the body model we need to use a little magic again, as this information is hard coded in the source code. During run time, the game will load a lot of information for attaching the models onto special places of other models. These places are called
tags. Our magic information tells us that there is a tag called
tag_headon the body model. Tags are represented as empties with the prefix
tag_and display type
ARROWSwithin Blender. Let's go into the collection for the body model and find this tag, just so we see how it looks like.
There are 3 kind of tags within the model formats. This one is attached to a bone with an offset. But there are also tags for bones without an offset and tags without any parent. We will attach the head model to this tag object by using the Attachment Panel. As the method for attachment we choose
Collection.
The method we chose attaches the objects within a selected collection to an active tag object. First deselect everything, then select the collection for the head model and then select the tag object called
tag_headto make it active. It is important that you select the tag object last, as only the active object will be considered a tag object by the addon. Click the Attach Button. The result is that all objects of the collection (our head collection) will be parented (or attached) to the tag object.
Importing and attaching accessoires
W:ET uses .skin files to configure the information for accessoire models of the body model. It is usually located at the same place of the .mdm file we just imported. Let's take a look at
models/players/temperate/allied/engineerand beside the .mdm file in this folder you will also find a .skin file called
body_engineer.skin. The file encodes shading and attachment information.
The information is made up of key-value pairs. For example
md3_hatdefines the helmet model found at
models/players/temperate/allied/helmet.md3. This helmet model is supposed to be attached to a tag object. Unlike the information for shading which describes real surface names (for example
l_legs), the name for the tags are again .. magical. You have to browse the source to find out the actual name. For example
md3_hatmaps to
tag_mouth. To make it a bit more confusing,
tag_mouthis actually located in the head model, not the body model.
The addon provides a method to read these .skin files and automatically import and attach the accessoire models. Go to the Attachment Panel of the addon and switch the method to
Skinfile. For the input field called
Game Pathenter the path to your game data. This is usually the etmain folder containing all extracted .pk3 files. We prepared this folder in chapter Extracting the game data. For the input field called
Skin Filepathchoose the absolute path to the skin file from above. It's relative path is:
modelsplayerstemperatealliedengineerbody_engineer.skin.
Deselect everything, then select the body collection to make it the active collection, and click the Attach Button. Your models will then be imported and attached to the appropriate tags from the body model. We need to fix the helmet attachment, because as mentioned, the helmet references
tag_mouthfrom the head model, not the body model. In the Attachment Panel switch the method again to
Collection. Then proceed like in the previous chapter to attach the helmet collection to the tag object called
tag_mouthfrom the head model. The same goes for the rank model. It too attaches to tag_mouth. The result should look like this:
Shading
Shading just means we tell the game how to put color on the surfaces (in Blender these are the individual objects) of the model. It basically defines surface properties which tell the game how light interacts with the surface, for example to make it transparent, or to use multiple textures and blend them together. The game uses so called
shader namesfor that.
In this addon, the shader name of a surface is encoded into the material name of an object inside Blender. If there is no material after import, then this is totally normal. This just means the game uses .skin files to shade the model. If we look at our imported models in Blender and expand their outliner views, then we can see that only the backpack model contains materials. Note the names of the materials, these are relative paths to the game path.
The Shading Panel therefore provides two methods: shading by 'Material Names' or shading by 'Skinfile'. Let's do the shading by material names first. In the Shading Panel, the input field called
Game Pathshould be already set from the previous chapter. To see the shading, we must switch
Viewport Shadingto
Look Devmode. Then we select the backpack collection to make it active and click the Apply Shading Button in the Shading Panel.
Now for that shader name again. This is a reference to either a texture or shader script. Shader scripts are made up of small code snippets defining surface properties. Each code snippet is headed with a shader name. If the game does not find such a shader name in one of these script files, it will resort to finding a texture with that name. First it will search for .tga files, then for .jpg files. That is how the game finds its color info for the surfaces of the model.
We need to use .skin files to shade the rest of the objects. The .skin files are usually located in the same directory as the model itself. Here are their locations. Remember to use the absolute path.
- helmet: models/players/temperate/allied/helmet_engineer.skin
- head: models/players/hud/allied_engineer.skin
- body: models/players/temperate/allied/engineer/body_engineer.skin
Shading by Skinfile works the same way as with material names, that means we select the collection to make it active, fill in our input fields, and click the button. The addon will then read the .skin file information and apply the shading. After doing this for all three collections we get the additional shading information.
There are two surfaces which we or the addon did not shade: its the strap surface of the helmet, and the rank model itself. The strap surface shading is a limitation of the addon: it simply can't read shader scripts yet. We have to manually do that in Blender if we want to. The rank model is shaded dependent on the rank of the player ingame and this information is hardcoded within the source code.
Fixing the strap surface
The shader name for the strap surface is defined in the helmet_engineer.skin file. This is a good time to explain how shading works for .skin files, because as we saw above, a .skin file can also contain information about attachment. A .skin file uses key-value pairs to do the shading for a model. The key is be the object name (or surface name as the game calls them), and the value is the shader name.
The strap surface has a shader name called
models/players/temperate/allied/strap. After searching all .shader files from the game we can find out that this shader is located in a file at:
scripts/models_players.shader. The shader script has 2 lines: the first line tells the engine to draw the surface from both sides (culling disabled). The second line contains the reference to a texture. We will use that texture for shading.
As already mentioned, the addon does not support reading shader scripts, so we just copy the path to the texture which is:
models/players/temperate/allied/inside. As it happens, this shader name already exists in our current set up, so we just assign this material in Blender to our strap surface.
Fixing the rank model
The rank model uses multiple shaders, because each time a player ranks up in xp, another shader is drawn. For that reason the shaders are hard coded inside the source code and change dynamically. Let's apply some magic again and use the shader name
gfx/hud/ranks/rank4for the material name of the strap surface. After using the
Shading Panelagain we see that the rank model is shaded by the texture, but the texture is meant to be transparent.
To apply our last fix we will open up the Shading Workspace. After opening the workspace, you will see the standard nodes the addon wrote. These nodes get written when you use the
Shading Panel.
To make the texture transparent inside Blender we add a Transparent Shader and a Mix Shader and connect them. Additionally we open up the Settings Panel by pressing 'N' in the node editor and go to Options. There we set the Blend Mode option to Additive.
User Preferences In Blender 2.8
If everything went successful, we have a first basic character going in Blender, ready for screenshots, icons, and the many more possibilities of Blender. That concludes the import example. In the next chapter we will export that same character for use inside the game.
Export of the Character
In this section we are going to export the character from the previous section to an MD3 model. This model will include the bind pose frame, a walking animation, and an idle animation. But before that, let's review what we already have.
What we have
In the previous section we imported, assembled and shaded a complete character from W:ET. We have 5 models: body, head, backpack, helmet and rank.
As we used the shading panel to shade the model in Blender, we now have all shader names in Blender. These are represented as material names. We will keep on using these material names for export. The alternative is deleting them all again and use the object names inside .skin files for shading, or a mixture of both.
The body model and the head model are the only models which contain animation. The body model is animated by a skeleton. The head model is animated by shape keys. Since we export to MD3, this is totally fine. The skeletal data will just be converted.
Additionally, we should probably clean up our tags. You might have noticed that some names, for example 'tag_mouth', end with '.001'. Also, since we don't plan on using them anymore, we should exclude most of them, if not all, from the export by making the objects invisible. But for now we leave everything as is.
Preparing the animations
Before we export, we must prepare our animation data. We have to choose which frame ranges we want to include, and modify the existing animations so that only a couple of animations are exported.
Deleting existing animations
We do not need the animations for the head model, so we will remove them. The imported animations are stored as actions inside Blender. We can delete them in the Outliner editor type. There we switch the Display Mode to Blender File, locate the Actions tree, and delete every action except the
mdx_skeletonaction. We delete the actions by selecting them, right clicking the marked context, and clicking
Delete.
Choosing frame ranges
Animations for models are referenced by .anim script files by the game. We can look into these files to get an overview. For the head model the script file is located at:
animations/human/head/base.anim. For the body model it is located at:
animations/human/base/body.aninc.
From our body animation we want the bind pose frame, an idle state and a walking state. After opening the file for the body animation we choose the following frame ranges:
Animation Name | Start Frame | End Frame | Duration |
---|---|---|---|
relaxed_idle_no | 1094 | 1312 | 219 |
relaxed_walk_1h_2 | 1458 | 1553 | 96 |
Additionally, we pick frame 32 for the bind pose frame.
Editing frame ranges
We need to delete and move certain keyframes. Yamaha dgx 220 midi driver for mac. For deleting the key frames we use markers. The markers will help us to select all key frames in between them, so that we can delete them. To set a marker go to the Marker menu in the time line and click 'Add Marker'.
We put markers on the following frames: 0, 31, 33, 1093, 1313, 1457, 1554, 4862.
Next, we need to switch our editor type from
Timelineto
Dope Sheet. Inside the Dope Sheet Editor we switch to Action Editor and select the Action called mdx_skeleton. Then we select all pose bones by selecting our armature object, switch to pose mode, and select them all. Finally select the markers at frame 0 and 31, go to the
Select menuand click
Between Selected Markers. The selected key frames can now be deleted.
After doing that for all our frame ranges, we have only 2 animations left. We need to move them to the beginning on the time line. We do this by selecting them, and pressing 'G' to drag them around. If everything went successful, you should have your key frames set up, ready for export.
For the export we use the Export Panel. First set the end frame in the time line (in our example it is 315). As we do not want to include the rank model for export, we simply hide its collection in the outliner. Finally, fill in the panels input fields, select the top level collection called
Scene Collectionand click the export button.
That concludes the export example. You can download the final character here if you want. In the next chapter we are going to delve into export in more detail.