[GUIDE] Blender, TF2 and You

Discussion in 'Tutorials & Resources' started by Mick-a-nator, Apr 3, 2010.

  1. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    So you want to start modelling for TF2? You can't get your hands on a copy of 3ds max? You've tried Blender but it never seems to work? Then here are some important things you should know and learn.

    STEP 1: Setting up
    First, you'll need Blender of course! Go to Blender's website and download either version it presents (2.49 and 2.5x). It doesn't matter which you choose, but Blender 2.5 is very different to 2.4, and they each need different scripts and the one for 2.5 doesn't yet support animation. For this guide I have used Blender 2.48, but 2.49 should have a very similar interface.

    STEP 2: Importing
    If you want to edit a previously existing model, you'll need to decompile it and import it into blender (Skip to step 3 if not). I'm not going to explain decompiling, but this is a good tutorial for that.
    Now that you have your SMD files, you are going to need to get an import plugin for Blender. There are a few about, but I use this one. It allows you to import all the texture information (including the UV layout) and generally I find it better and more reliable. WARING!!! it does however scale down the model by a factor of 40! This is extremely important as if you don't scale it back up, you will get tiny models when you export and compile. Another little annoying thing with this is that it imports an armature no matter what it is that you import. You need to delete it and everything that points to it otherwise you can't export it as a static prop.
    [​IMG]
    [​IMG]

    One last thing to note on this script is that, where it does import bones, it can't import animation.

    For Blender 2.5 users, use this. The only known problems are listed on the page.

    STEP 3: Modelling
    I'm not going to go over this. There are so many tutorials out there for you beginner modellers. To start you off, try Blender Noob to Pro.

    STEP 4: Texturing
    This should be in Blender Noob to Pro, but I'm just going to quickly run over it. After you have made your UV layout and textured it, you just need to link it to the mesh. Under "Links and Pipeline" in the Shading panel (F5) change MA:Material to the name of your texture with .vmt on the end for good measure (might not be necessary, but I do it to make sure).
    [​IMG]
    If you have multiple textures for one mesh, you have to go through this process. First, go into "Links and Materials" in "Editing" (F9) and click "new".
    [​IMG]
    You should now see the box above say "2 Mat 2". Now you have to go back to "Links and Pipeline" and change the name of this texture. Back again to "Links and Materials" and select the faces you want to have this new texture and hit assign, making sure the box still says "2 Mat 2".
    [​IMG]
    Select the other faces (ctrl+i inverts the selection) and hit the left arrow in the box to change it back to "2 Mat 1". Hit assign and you're done! If you have more than 2 textures, obviously repeat until everything has been assigned.

    STEP 5: Exporting
    When you're done, you'll need to export your beautiful model into SMD. Here you need another script. I use this one but I think there are others about. Just start the export script, select if the object is a static prop, the phys mesh, or an animated prop and tell it where to put it.
    When exporting animated meshes, you will need to select BOTH the mesh and the armature. (more on this later, when I have more information)

    Blender 2.5 users can use the same script I linked earlier to export your meshes.

    STEP 6: Compiling
    Remember that link I gave earlier for decompiling models? Go back to it, it will explain compiling models too!

    Specific cases
    This section will be kept up-to-date as situations arise which need to be covered.

    Weapons and hats
    I will go over this as if you have already created and textured a hat model. Begin by importing the model of that class for which your item is for (these can be found in your sourcesdk_content/tf/modelsrc folder) and scale by 40 as mentioned before, but preserve everything else, you'll need the armature. Now position, scale, and edit your model so that it fits and looks as desired. Next, remove the character model BUT NOT THE ARMATURE. Then you need to parent your model to the armature, and "skin" the model so that only the right bones are controlling the model. If you are creating a basic hat then you'll need to make the head bone (often called "bip_head") have 100% control over the model, and no other bones. I wont go over how to do these two steps, they're a common Blender techniques. Finally you just need to export the model with the armature as mentioned above.


    And now you're done! Just load it up to check if it has worked then you can do what you like with it!
    Enjoy your new skills and get creative!
     
    • Thanks Thanks x 22
    Last edited: Aug 12, 2010
  2. zpqrei

    aa zpqrei Theme Changer Extraordinaire

    Messages:
    1,067
    Positive Ratings:
    1,123
  3. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,745
  4. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    Damn image shack! does it work now?
    I'll add more images tomorrow.
     
  5. Firest0rm

    Firest0rm L4: Comfortable Member

    Messages:
    171
    Positive Ratings:
    33
    nope, still doesn't work for me
     
  6. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    From my experience you don't need to add .vtf to the end of the material name. .tga worked just fine for me.

    I was hoping for a little more when I clicked on this thread, but it's a decent starter tutorial.
     
  7. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    That's what it was supposed to be, a way of telling people some of the quirks of Blender.

    (I'll change that about vtf in the thread. On reflection it shouldn't need any file ending, but I'll check that)
     
  8. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    IMAGES!!!
    (do tell me if you think more are required, and if so where)
     
  9. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    I've made, and have been using a bunch of viewport and grid settings to make blender better match up with hammer. It means you don't need to worry about sizing things up to huge sizes.

    [​IMG]

    Here's the preferences .blend.
    http://dl.dropbox.com/u/49917/models/blender/.B.blend
     
    • Thanks Thanks x 3
  10. Tehrasha

    Tehrasha L3: Member

    Messages:
    115
    Positive Ratings:
    26
    That will come in very handy, Joshua!

    Mick-a-nator, could you include a similar guide to exporting animated models?
    There are so many options that can be set, it is very difficult to determine which ones are -required- and which are not.
     
  11. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    Very nice Joshua. Very handy indeed.

    I don't make (and therefore don't export) animated models much, but I'll have a look for you.
     
  12. Tehrasha

    Tehrasha L3: Member

    Messages:
    115
    Positive Ratings:
    26
    That would be great!

    Dont kill yourself on something complicated like a ragdoll.
    Just two bones would be sufficent. Im sure it only scales up from there. :)
     
  13. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    much of the stuff to do with bones are done in the qc file I believe (such as jiggle bones and ragdoll) but the animation sequences are in the models (and therefore that's what you export).

    EDIT: I've had a go at it, and I don't see your problem/confusion/whatever with exporting animated meshes.
    Here's what I did:
    Made an armature of 2 bones sitting in a cuboid (that had been subdivided a few time to make it actually bend).
    Animated it.
    Selected BOTH the mesh and the armature and just hit "Export -> Half-life 2 (.smd)... -> Animated Mesh" and it worked.
     
    Last edited: Apr 15, 2010
  14. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    To export different animations, just select them in the action editor and then export them as an animated mesh with a different file name.

    Also be sure you're using the "fixed" plugin, as it's the only thing that actually worked at exporting anything with an armature.
     
  15. Tehrasha

    Tehrasha L3: Member

    Messages:
    115
    Positive Ratings:
    26
    Here is the animated mesh that I am working with.

    [nomedia="http://www.youtube.com/watch?v=1ExBDZEay2U"]YouTube- Blender -- Doomsday Machine V.5[/nomedia]

    My confusion was which parts do I have to select when doing the export.
    The mesh, the armature, the bones, the animation sequence iteself? Some or all of the above?

    I -think- I know what to do now.
     
  16. Mick-a-nator

    aa Mick-a-nator

    Messages:
    640
    Positive Ratings:
    314
    yeah, I selected the mesh and the armature and it seemed to work, although I haven't tried compiling it or anything. Please tell me if your model works ok and I'll update the tutorial accordingly. For now I'll just add what I think is required.
     
  17. Tapp

    Tapp L10: Glamorous Member

    Messages:
    776
    Positive Ratings:
    211
  18. Tehrasha

    Tehrasha L3: Member

    Messages:
    115
    Positive Ratings:
    26
  19. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    I've updated my blender settings file. I've updated some settings based on an odd observation. When exporting from blender and then importing to source, the bounds of the model are .5 units bigger than the actual mesh. I've updated my settings file to compensate for this little quirk. Now when you export something the model will be the correct size, but the bounds will be .5 units bigger.

    http://dl.dropbox.com/u/49917/models/blender/.B.blend
     
  20. TrickyClock

    TrickyClock L1: Registered

    Messages:
    20
    Positive Ratings:
    0
    <Post edited because I was stupid enough to not read the very first post carefully. Either way, thanks a bunch for this tutorial!>
     
    Last edited: Jun 19, 2010