Forum

Absolute beginners guide to IQMs

Discuss the creation of various model formats for Quake engines, and related matters to modeling.

Moderator: InsideQC Admins

Absolute beginners guide to IQMs

Postby OneManClan » Sun Mar 15, 2015 3:07 pm

[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, and exporting it 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!

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! :x 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 :mad: ]

    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)]

The Skinning

    2. [UV/Image editor]: open your image file, lets call it 'amazing_skin.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]

The Animating

    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..]

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

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
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?".

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.

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
Last edited by OneManClan on Mon Apr 30, 2018 4:58 am, edited 29 times in total.
OneManClan
 
Posts: 243
Joined: Sat Feb 28, 2009 2:38 pm

Re: Absolute beginners guide to IQMs

Postby Bluntz » Fri Jun 26, 2015 12:57 am

Thank you very much,I only wish this was done years ago when I had tons of time on my hands :D
User avatar
Bluntz
 
Posts: 10
Joined: Wed Jun 22, 2011 4:08 pm

Re: Absolute beginners guide to IQMs

Postby OneManClan » Thu Jul 02, 2015 10:45 pm

Bluntz wrote:Thank you very much,I only wish this was done years ago when I had tons of time on my hands :D


You're welcome :). Hopefully, by taking out the guesswork, the guide will encourage modelers to get back into it, focusing their (precious) time on the creative stuff.
OneManClan
 
Posts: 243
Joined: Sat Feb 28, 2009 2:38 pm

Re: Absolute beginners guide to IQMs

Postby hondobondo » Thu Jul 21, 2016 6:52 pm

so is there a list of engines that support IQMs?
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Re: Absolute beginners guide to IQMs

Postby Spike » Thu Jul 21, 2016 7:53 pm

fte, dp, rmqe, directq(I think), quakeforge
(there are other non-quake engines too, like ioq3, but those are generally uninteresting to me)

only the first two can do rich animations thanks to csqc, the rest just treat them as a higher quality mdl. engines that do the animations purely on the cpu will have poor performance with the format.
Spike
 
Posts: 2881
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Absolute beginners guide to IQMs

Postby Irritant » Fri Jul 22, 2016 3:58 pm

Spike wrote:fte, dp, rmqe, directq(I think), quakeforge
(there are other non-quake engines too, like ioq3, but those are generally uninteresting to me)

only the first two can do rich animations thanks to csqc, the rest just treat them as a higher quality mdl. engines that do the animations purely on the cpu will have poor performance with the format.


Here is a full list - http://sauerbraten.org/iqm/

Moving to IQM or other skeletal will give you the benefit of doing some cooler things like bending at the waist per view angles, or ragdolls.
http://red.planetarena.org - Alien Arena and the CRX engine
Irritant
 
Posts: 250
Joined: Mon May 19, 2008 2:54 pm
Location: Maryland


Return to Modeling

Who is online

Users browsing this forum: No registered users and 2 guests