Sauerworld Forum

Modifying Sauer Player Models - Guide

Salatiel

  • ***
  • 105
  • +24/-1
    • Projects by Salatiel
Modifying Sauer Player Models - Guide
« on: October 15, 2019, 04:38:16 am »
Modifying Sauer Player Models - Guide
Installing the tools
First and foremost, you need to download Blender (version 2.79) and an add-on to it that will allow you to import models and animations with the .md5 format and export them.

Download Blender 2.79
https://download.blender.org/release/Blender2.79/
Download MD5 Importer & Exporter (thanks @pink-vertex)
https://github.com/pink-vertex/blender_addon_md5/archive/Release.zip

To install an addon simply open the "User Preferences" menu (CTRL + ALT + U) and go to the "Add-ons" tab, then follow the steps:


  • "Install Add-on from File" select the Zip (addon) you downloaded above.
  • Search for "md5" in the search box for addons.
  • Enable the addon checkbox.
  • Save the settings and close the window.

Attaching a new object to the character
Now you have everything ready to import any character in .md5, to do that just go to the File -> Import menu and select MD5 Mesh (.md5mesh) , navigate to your Sauerbraten models folder (sauerbraten/packages/models) and choose the folder of one of the characters (inky, snoutx10k, mrfixit or captaincannon), the file you should import will appear as charactername.md5mesh.


If all went well, the character should look like this:


Our goal will be to put Suzanne, mascot of Blender, in the head of Captain Cannon, just add it by going to Add -> Mesh -> Monkey, and then move it to the position you prefer.

(ignore captain cannon's textures, it's just for a better visualization)

Since these are optional steps, follow the links below if you want to know how to move, rotate, scale and texturize objects in Blender:
Move, Rotate, Scale
https://docs.blender.org/manual/en/latest/modeling/meshes/editing/basics/move_rotate_scale.html
UV Map Basics
https://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics

Now we need to attach our object to the "bone" of the character's head, so we will add an "Armature" Modifier to the monkey, just go to the tool icon and select it.


After adding an Armature, click on the "Object:" text field and choose MD5 (MD5 is Captain Cannon's armature name), then click the icon to the right of the tool icon to open the "Object data" menu.


Now you need to define which character bone our monkey should follow. To do so, change from "Object mode" to "Edit mode" and on the "Vertex Groups" tab, you will click the "+" visual button and rename the "Group" text for the bone name, in which case it will be "Head". By clicking on "Assign" all parts of our model will follow the character's "Head" bone.


Your modification is almost done, but before exporting back to .md5 you need to open your object's UV Map, ie define how the texture will interact with the faces of the model (our monkey). This is quite simple to do automatically, although the result is not very pleasant... Still in "Edit mode" press the U key and choose "Smart UV Project" and you're done, this step is necessary even if you don't want to add any texture to the model.


Now you need to go back to "Object mode" and apply the Position, Rotation and Scale of the monkey, press CTRL + A and choose "Location", press it again and choose "Rotation & Scale".


Now you can export, select the whole character (including your object, make sure to select the armature last, otherwise the export button will not be available). Just replace the .md5mesh that you had imported before.


And good job, you just made your first mod!


Texturing things

This yellowish color with white text means that the model has no texture, and to add it you will need to make some modifications to the md5.cfg file of the character you have chosen. If you are already a Blender lover, you probably already know how to make and organize textures in your model, so in this topic we will cover how to configure these textures in Sauerbraten.
A .cfg file is a simple text file that contains several commands, this text file can be executed manually by the player or automatically by the game. You will find your character's .cfg file in the same folder as his .md5mesh is.

Below is an example of the Captain Cannon cfg file, it is responsible for loading the model and applying the textures, as well as running the other files that configure the animations and etc.

sauerbraten/packages/models/captaincannon/md5.cfg

1 md5load "captaincannon.md5mesh" captaincannon 70
2 exec "packages/models/captaincannon/ragdoll.cfg"
3 md5tag Weapon tag_weapon
4 md5skin head "<dds>cc_head.png" "<dds>cc_head_mask.png"
5 md5bumpmap head "<dds>cc_head_normals.png"
6 md5skin body "<dds>cc_body.png" "<dds>cc_body_mask.png"
7 md5bumpmap body "<dds>cc_body_normals.png"
8 exec "packages/models/captaincannon/anims.cfg"
9 mdlscale 1225
10 mdlspec 60


You only need two things: The image to use as the texture and the name of the mesh to apply the texture to.
How to get the name of the mesh? It's simple, go back to Blender, select your object and see in the lower left corner what its name is, you can also modify it by pressing N and going to the "Item" tab.



You will probably have your own texture but for now we will steal a texture that is already in sauer, so we use md5dir to navigate to any other folder inside sauerbraten/packages/models.

Here we are accessing the folder sauerbraten/packages/models/tentus/chains (md5dir) and applying the skin.jpg texture on the Suzanne mesh (md5skin).

1 md5load "captaincannon.md5mesh" captaincannon 70
2 exec "packages/models/captaincannon/ragdoll.cfg"
3 md5tag Weapon tag_weapon
4 md5skin head "<dds>cc_head.png" "<dds>cc_head_mask.png"
5 md5bumpmap head "<dds>cc_head_normals.png"
6 md5skin body "<dds>cc_body.png" "<dds>cc_body_mask.png"
7 md5bumpmap body "<dds>cc_body_normals.png"
8 exec "packages/models/captaincannon/anims.cfg"
9 mdlscale 1225
10 mdlspec 60
11
12 md5dir tentus/chains
13 md5skin Suzanne skin.jpg

When you use md5dir, every md5 command below it will use the dir you chose as reference.

And you're done, the monkey should look like this:


Yeah it's horrible, but you got it...
It's all a matter of practice and creativity  ;D

Common errors:
Export button is unselectable = Means you didn't select character armature last.
AttributeError BMElem[key] Invalid key... = You didn't open your model's UV map.

I hope this post was helpful, below are some interesting links:
Sauerbraten MD5 Model Reference
http://sauerbraten.org/docs/models.html#md5_format
Blender Weight Painting
https://www.youtube.com/watch?v=Tl4qTgwQwYw
Blender Texture Mapping
https://www.youtube.com/watch?v=eiDrRa6JvQ0
Blender Rigging
https://www.youtube.com/watch?v=Y0btZFIeGtY
How to animate a mapmodel in Sauerbraten (portuguese)
http://www.cubebr.com/2018/10/como-animar-mapmodels-do-sauerbraten.html

as our dear Suicizer would say: be sure to check the licenses before modifying any model!
« Last Edit: October 15, 2019, 04:35:44 pm by Salatiel »
@Salatiel#5274

h8

  • **
  • 81
  • +6/-2
Re: Modifying Sauer Player Models - Guide
« Reply #1 on: October 17, 2019, 07:08:54 am »
nice guide. probably not gonna try it , it looks like hard work. but nice guide for those who might want to.
annoyin noob #477462

Salatiel

  • ***
  • 105
  • +24/-1
    • Projects by Salatiel
Re: Modifying Sauer Player Models - Guide
« Reply #2 on: October 17, 2019, 05:28:45 pm »
nice guide. probably not gonna try it , it looks like hard work. but nice guide for those who might want to.

Thanks h8!
it seems hard but in the end it's just a bunch of buttons to click in order ;D
@Salatiel#5274

Master

  • *
  • 22
  • +2/-0
  • Noob
Re: Modifying Sauer Player Models - Guide
« Reply #3 on: October 20, 2019, 12:32:30 pm »
good job salatiel, very admirable work you are doing, I'll definitely try it out

TristamK

  • *
  • 36
  • +3/-0
    • Cube 2 Engine News Group
Re: Modifying Sauer Player Models - Guide
« Reply #4 on: November 02, 2019, 10:07:52 am »
Good job. In one day if my plans will start work i will try it.
Russian news group about Cube 2 Sauerbraten in VK ->vk.com/cube_engine_news
International Sauerbraten Mapping Community