Absolute beginners guide to IQMs

[UPDATE October 2021: This tutorial was salvaged from the (now dearly departed insideqc.com). I tried to format it so it looks ok here, there are still some formatting errors, but hey – the info is ALL HERE!]

[UPDATE August 2019: Blender 2.8 is here, so ‘things have changed’. I’m still figuring it out, but I *think* you need to use the nodes editor. Also you need to get an updated iqm exporter from here

[UPDATE August 2018: Updated animation info – you CANNOT export Blender-> iqm without at least 1 animation (ie w at least 1 bone) listed in the export panel]

[UPDATE Jan 2018: Added more info on probs with NOT using ‘automatic weights’ in Blender]

[UPDATE Jan 2017: Corrected some mistakes re: the correct format for animation information you type in the Blender-> IQM ‘animations’ box]

[UPDATE Dec 2016: Added a great link for setting up Blender to paint directly on a model]

PREFACE
First and foremost, a big thanks to the Gurus on #qc, and an especially BIG THANKS to Shpuld, who kindly made a video of him making an iqm from scratch, which finally put all the missing pieces in place, and made this guide possible. This is my attempt to put the teachings of these quake+iqm gurus into a ‘step by step’ format anyone can follow. I’ll be constantly editing this, anytime new information comes along, or a better way to describe something. Anyone reading this please check back for refinements, and read the comments/corrections/clarifications (below) from those who know more than I.

INTRODUCTION
I’m assuming if you’re reading this you already know what an iqm is, and why they are superior to mdls. [TO DO: Do we need a list of advantages here?] The Official IQM Page is very technical, and the info on implementation is scattered here and there. Much of the information assumes you already know other information, which can be very frustrating if you’re completely new to all this. Anyway, this is the guide I wish I had years ago. An unapologetically hand holding, ‘step by step’ guide for taking a Blender model, exporting it, and having it appear in-game as a valid, perfectly skinned and perfectly animating iqm. It’s aimed at beginners of course – and to a potential future me who has forgotten some crucial detail! Many of the tips here have stories of pain, frustration and wasted time behind them!! Deviate from these steps at your own risk!

Part 1: WHAT DO I NEED?
You’ll need:

  1. Blender (I’m using version 2.7a at the time of writing)
  2. The iqm exporter iqm_export.py   (more info below)
  3. The Noesis model viewer – the best way to check that your iqm is skinned, animating, and 100% ready for installation into your game!
  4. FTE

Part 2: HOW DO I INSTALL THE IQM EXPORTER?

    1. You should have a file called ‘iqm_export.py’ (see Step 2, above). I’m not sure this is the ‘correct’ method (Gurus?) but I copied the raw text of the script  into a text file, and called it ‘iqm_export.py’ and put it in blender\2.68\scripts\addons. [Yes, I’m using Blender 2.7, but this still works.. ]
    2. Open Blender
    3. [User Preferences screen] Click ‘addons’ at the top
    4. Click ‘Install from file’ button at the bottom. Go to the directory ‘blender\2.68\scripts\addons’ and select ‘iqm_export.py’. The plug in is now installed. So, now we’re ready to go, right? …. WRONG! We now need to ‘activate’ it.
    5. Click on ‘import -export’ from the list of options on the left, and look for ‘Import -Export: Export Inter Quake Model (IQM) ‘ in the list of addons, and click the little arrow thing to open it up (jeez maybe a video would be better!), and tick the box in the upper right corner. [Tip: While you’re on this screen, click on the ‘Save User Settings’ button at the bottom, otherwise you’ll have to do this step every time
    6. [Info screen] File should now have an option : Export-> ‘Inter Quake Model (.iqm, .iqe)’. This means we’re ready to go!

Part 3: Blender -> IQM!

        • 1. Open Blender, make the model.

[Note: I’m assuming there are some limitations on what kind of model can be exported, ie what a client such as an FTE or a DP can ‘handle’/’accept’ .. need more info..] [Note 2: I’m not sure of it’s ‘best practice’ to up-size the model (ie to Quake proportions) here, or during export..] [Update (Jan 2017) Note 3: For the record, Blender->IQM exporting should involve rotate the model 90 decrees anti-clockwise, and export upsizing by 8 (ish)]
3.1 The Skinning

        • 2. [UV/Image editor]: open your image file, lets call it ‘amazing_skin.tga’. [Note: you can use *.tga and *.png, but NOT *.jpg]
        • 3. [3D View], edit-mode->UVmap (“U” -> ‘smart UV Project’). You should see the models UV map in the UV/Image editor.
        • 4. [UV/Image editor]: select amazing_skin.jpg by clicking the ‘icon + up&down arrow icon’ (to the left of the ‘+’ sign to the left of the word ‘New’). (It says ‘browse image to be linked’) (ugh ill add a screenshot)
        • 5. [3D View]: switch to texture mode so you can see amazing_skin.jpg on the model. [tip: delete (is disable possible?) your light source(s), so you can view the skinned model without shadows]
        • 6. [3D View], edit mode, select the object
        • 7. [Properties Screen], material section -> change the name of the material, by typing in ‘amazing_skin’. [ Ugh, THIS was the missing step!!!

:x

        • Thanks again to Shpuld for demonstrating this in his video!]

[Update 2016: Just came across this fantastically clear and fast (3 minutes!) tutorial on Texture Painting in Blender (ie painting directly on the model]

        • [Update 2018: Shpuld says “if you set the models shading to flat in blender and export to iqm, it’ll be flat shaded in game too”]

3.2 The Animating
[EDIT: Fantastic Beginners Rigging Tutorial]

        • 8. [3D View], object-mode, add a bone (shift + A -> armature->single bone)
        • 9. [3D View], deselect everything, select mesh, then select bone (important, do it in THAT order!), then ctl P ‘set parent automatic weights’. [UPDATE Jan 2018: I just had an issue w using ‘set parent to bone’ where the result was an iqm which FTE couldn’t see (but Noesis could!). If anyone can explain what the prob is, please do so, meanwhile, you need to use one of the ‘Armature deform’ options when using ctl+P

:mad:

        • ]
        • 10. [3D View], select the bone
        • 11. [3D View], pose mode -> do the animations (by moving the bone, not the model, remember old timers: this is NOT a *mdl, were animating the bone, not the mesh. The mesh follows the bone)
        • 12: [Outliner]: Rename the animation something descriptive. For now, I’ll assume you called it ‘walk’, because we’ll need this name later during the export. [Note: In Shpuld’s video, he does it in the Dope Sheet, but for some reason, My Dope sheet refused to let me rename anything..

:x

      • ..no idea why.. anyway..]

3.3 The Exporting

        • 13: [3D window], object mode -> select everything (ie the mesh AND the armature)
        • 14. [Info screen] File->export ->’Inter Quake Model (.iqm, .iqe)’
        • 15. Bottom left, look for the ‘Export Iqm’ section, and put in these settings:

materials

        • : material

Animations

        • : Here, you type in details of your animation in the following format:
actionname:startframe:numframes:fps:loop
        • For example, lets say your animation/action is called ‘walk’ and it runs from frame 1 – 20, at 30 frames per second, and it loops:
walk:1:20:30:1
        • Note 1: Use ‘:’ to separate these values, NOT ‘;’
        • Note 2: Use ‘,’ to separate multiple animations.
        • Note 3: Sometimes Blender keeps animations settings from the previous export. Check before you export that the right settings are in there.

[UPDATE Dec 2016: It’s better/easier to use the Action Editor, put each animation on its own timeline, and export with just the names of the animations, like this (in the “Animations” box): “run,stand,walk”. Here’s the relevant excerpt from the documentation for the IQM Exporter:
“The “Animations” field contains a comma (“,”) separated list of action names to export. The names can also have parameters of the form “name:X:Y:Z:L”, where X is the start frame number, Y is the end frame number, Z is the frames per second (floating-point), and L is 0 or 1 to indicate looping. Earlier parameters can be left empty as in “idle::::1” to specify only a later parameter, and later parameters can be omitted if unnecessary as in “run:1:25″.”]

Update Nov 2017: If you intend to use skeletal animation, you will NEED to save with at least 1 entry in the ‘Animations’ field! Otherwise… skeletal animations won’t .. work! :cry:

Update Jan 2018: Here’s some info on export issues

        • 16. Export! [Note: Make sure you save with a name which doesn’t already exist in the directory, because (on my system anyway) it simply wouldn’t save ..

:x

        • no warnings, no error messages, no nuthin’!] [EDIT: The name is in red if its already taken]
      • 17. Make sure your image (‘amazing_skin.jpg’) is in the same directory as foo.iqm

3.4 The Checking

      • 18. Examine the iqm in Noesis, to confirm that the textures and animations are 100%, *before* you start implementing it into your game.

Part 4: IQM -> QUAKE
4.1 The Installing
The ‘making it appear in Quake’, is as simple as

Code: Select all
precache_model("progs/whatever your path is/foo.iqm");

.. and then somewhere else:

Code: Select all
 setmodel(self, "progs/whatever your path is/foo.iqm");

.. so the real question is “how to animate it?”.

4.2 The Animating
If your iqm is a direct replacement for an existing quake model (ie the animation order and number of frames is identical to the original .mdl), it’s actually VERY EASY to get it in game. Apart from

Code: Select all
setmodel(self, "progs/your_replacement_iqm.iqm");

all you have to do is put a text file called “your_modelname.iqm.framegroups” in the same directory as the iqm, which contains frame by frame info in the format described here.
[edit: that link is dead, framegroups are explained here]

If your iqm is NOT a direct replacement for a Quake model, then you can either have it auto animate (which IIRC is initiated by self.frame = 0;). Otherwise there’s this whole other area of how to animate it which will be added to this section as soon as I understand it enough to explain it! 😕

NOTES:
1. With most models, you’ll be dealing with multiple bones, multiple animations, and possibly multiple image files, but the same basic workflow should apply. To check, go Noesis->Tools-> ‘Data Viewer’ to confirm that everything exported with the right settings.

2. Tip (credit Spike): Put your iqm and accompanying image file(s) in a pk3, all in the same folder, so that when clients auto-download the iqm, they will automatically get the image file(s), all in the correct location. Nice. [UPDATE: Auto pk3 downloads will be an option in the upcoming EZQuake 3.0! You heard it here first folks!! :)]

That’s IT!! :)

Your suggestions/comments welcome!

[APPENDUM (draft for part 2):
1. Blender: put the animations in different actions using the action editor

2. You don’t need frame numbers. The length of each action/animation will be from the first keyframe, until Blender reaches the last keyframe, so you don’t need a start/end. Use the export format:
<name_of_animnation>:::frames:loop,<name_of_animnation2>:::frames:loop,<name_of_final_animnation>:::frames:loop

eg: walk:::10:1,run:::10:1, etc. (I don’t think you even need frames, the iqm stores it, and Quake plays it)

3. Make sure you are in Object mode, and select everything before export!

4. TESTING IN CSQC

Code: Select all
// Print all the IQMs animations:
print(sprintf("IQM Contents of %s:\n", "progs/whatever_your_path_is/monster.iqm"));
string str;
float i = 0;
str = frametoname (self.modelindex, i);
while (str)
{
print(sprintf(“Animation %g: %s length: %g\n”, i, str, frameduration(self.modelindex, i)));
str = frametoname (self.modelindex, i);
i++;}self.total_animations = i;

]

HANDY LINKS + WISHLIST (WE NEED MORE BEGINNERS GUIDES PEOPLE!):
1 . “IQM and Animation?” (Framegroups discussion).

2. Excellent Skeletal animation info (& example code) is found within: “How makevectors works, really?”. Also, “CSQC skeletal animations played by anim name”. Also GOLD = toneddu2000’s working (!!) skeletal animation (+ more) mod w links to his source code in “fteskel
3. Controlling the legs and the torso separately! <I think I’ve seen this discussed on i3d, but can’t find it .. EDIT, its in “frame1time in FTE”>
4 . Controlling the speed of animations in qc/csqc dynamically (ie the faster you move the faster the animations are)! <Coming Soon Hopefully>
5 . Controlling the animation so steps match stairs/ramps etc ! <Coming Possibly>
6 . Adding (and positioning) attachments (“setattachment and collisions”)
7. VWEPS! <still in discussion>
8. HATS!! <DONE>
9 . Making it so when you turn your head, the players head also turns! <Coming possibly>
10 .ragdoll physics!
12. bouncing boobs!?! <“Man’s reach exceeds his grasp”> ;)
13. IQM architecture and collisions tutorial
14. Fantastic introduction to Blender rigging and IK

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>