User:Mr. Magoolachub/HLMV Stuff

From Team Fortress Wiki
Jump to: navigation, search

So I noticed there wasn't all too much documentation or resources surrounding HLMV, and while taking images there were many thing that I didn't know how to do that I had to bumble through and figure out for myself. This page will serve as an ongoing list of stuff that I've figured out how to do so that you don't have to.

Setting up HLMV

This one I thankfully didn't have to walk through on my own, you can find out everything you need to know right here: Help:Model_Viewer

Moving Around in HLMV

  • Left-click in the center of the circle to rotate the model.
  • Left-click at or around the edge of the circle to tilt the camera.
  • Right-click to zoom in and out.
  • Shift + Left-Click to pan the camera.
  • Ctrl + Left-Click to adjust the lighting.

Turn on Normal Mapping

Turn on Normal Mapping.

Posing a Model

Head on over to the Sequence tab for this. You'll see five drop down boxes on the left, leave the topmost one as is (usually ref/idle), don't change this one for poses. Instead, use the next box down to select the animation you want, and then move the slider immediately next to it to maximum. The "Frame" slider at the bottom controls which frame of the animation the model is paused on, and the radio box controls which animation you are altering (so you should select the radio box next to the second drop-down menu at this stage). You can see the animation play through as it would in game by dragging the slider directly underneath the drop-down menus for animations. Simply find an animation and a frame you like, and snap a picture.

Animation Blending

Some of the images on the wiki you may find use poses that you can't seem to find in any frame of any animation. These are likely a blend of two or more animations. To do this, go to the next drop-down animation menu and select a different animation. The slider next to it will control how much it is blended with the previous animation, from not at all, to total priority. Note: Each drop down menu has successively greater priority.

Running Animations

Run animations do not animate simply by dragging the fps slider, you will need to use the move_x and move_y sliders to the right as well. body_pitch and body_yaw are also useful.

Ubercharged Weapons

So you need to have that minigun ubered for a picture, but you don't know how? No worries, I've got you covered:

       "$basetexture"	      "effects/red"
                              "$bumpmap" "water/dx80_tfwater001_normal"
       "$bumpmap" "water/tfwater001_normal"
       "$envmap" "effects/invun_red" // For RED
       "$envmap" "effects/cubemapper" // For BLU
       "$surfaceprop" "metal"
       "$halflambert" "1"
       "$phong" "0"
       "$selfillum" "1"
       "$selfIllumFresnel" "1"
       "$selfIllumFresnelMinMaxExp" "[0 18 13]" // 0.0 1.0 1.0 is the default
       "$invulnlevel" "1"
       "$invulnexponent" "1"
       "$invulnfmax" "18"
       "$invulnscale" "0"
       "$invulnphong" "1"
       "$half" "0.5"
       "$invulnphongfading" "0"
       "$invulnphongfull" "1"
       "$invulnphongoutput" "1" 
       "$invulnexponentfading" "1"
       "$invulnexponentfull" "13"
       "$invulnexponentoutput" "1"
       "$invulnfmaxfading" "-31"
       "$invulnfmaxfull" "18"
       "$invulnfmaxoutput" "1"

Copy and paste that block of code, comment out any existing conflicting values (e.g. place // in front of the existing "$basetexture"), press f5 in model viewer and you should now have yourself a red (or blu) hot glowing piece of Ubercharged weaponry.

Painting Hats takes Ages

You're correct, it does! Changing the values and then pressing f5, taking a screenshot, pasting and editing each photo takes forever, instead, try using i-ghost's script, which can be found here.

Alternatively, here is another way, quicker than doing each individual image, but longer than using i-ghost's script. If you're familiar with Photoshop, you probably won't need any of this:

  1. When pasting the screenshot in Photoshop (sorry any other image editor users), instead of creating a new image for each paint, instead, just continuously paste each screenshot on to a new layer of the same image.
  2. Now, crop your image to not include anything other than the model and the background (don't try to be precise, photoshop can do this for us later, leave a wide area of background around your model).
  3. Put all your layers in to a new group
  4. On any of the layers, now use the Magic Wand tool to select the background, and use Refine Edge twice (I like to use the values Radius: 0, Smooth: 1, Feather: 0.2, Contrast: 0 and Shift Edge 0, make sure to leave Smart Radius and Decontaminate Colors unchecked).
  5. Now, invert the selection and select the Group (as opposed to the individual layer), then press the "Add Layer Mask" button. You should see the background of your image become transparent.
  6. Crop the image to just around the borders of the model, allow Photoshop's automatic snapping to assist you.
  7. File>Scripts>Export Layers to Files with file type png-24, transparency and trim layers ticked. Set your directory and prefix to whatever, and click Run. This will take a while, so just do something else while Photoshop works.
  8. You're done! Optionally, you can choose to rename your images with a more descriptive name than their layer number, I like to use gX_Y_<Z_>name (where X is the group the image belongs to (based off the painted variants table), Y is it's position in the group, Z is the team colour (r or b where applicable), and name is the name of the paint (feel free to shorten, I use "badpink" for Color No. 216-190-216 and "pants" for The Color of a Gentlemann's Business Pants))

Rotation Values

I've been slipped up by the registry's rotation values before, sometimes it doesn't save the values until you load another model, so it's best to close HLMV or open another model before taking note of your Rot, Trans and lightrot values.

Decompiling Models (previously: Posing All-Class Hats which have Animation sequences)

Note: I think Valve have now split all multi-class hats in to their own individual hats, so the following is now largely irrelevant for the purpose of posing all-class hats with animation sequences.

"Hey Magoo made a really bad picture of the Alien Swarm Parasite, man it sucks, I bet I could make a better one, let me just-hey wait what this isn't supposed to look like this! How do I make it grip the Heavy's head properly? Argh, it isn't working, I give up!", well friend, I'll look past your rather degrading insult and help you out. The process of posing all class hats that store the individual class poses in animation sequences (such as the parasite, the headsplitter, the wiki cap and others) is more complicated than it really should be, but I'll walk you through it (or at least, how it works for me, if this doesn't work for you I really can't help :S):

  1. Download and install GCFScape if you have not already done so.
  2. Download and install StudioCompiler, follow the instructions given to set up.
  3. Download this zip file with empty folders in it (no, really): here and extract it where you wish the decompiled model to go.
  4. Launch GCF Scape and load the "tf2_misc_dir.vpk" (it should be in your steamapps/common/Team Fortress 2/tf" folder).
  5. Extract the 6 needed files (to the same directory), for example, the parasite would require me to extract:
    1. parasite_hat.dx80.vtx
    2. parasite_hat.dx90.vtx
    3. parasite_hat.mdl.
    4. parasite_hat.phy
    5. parasite_hat.sw.vtx
    6. parasite_hat.vvd
  6. Now, open "parasite_hat.mdl" in notepad (or, preferably, notepad++), you will see a bunch of gibberish, this is fine, you don't need to worry about it, just change "IDST0" to "IDST,", save the file and close it.
  7. Launch StudioCompiler, go to the "Model Decompile" tab and select the "parasite_hat.mdl" from before using the file chooser, then without using the file chooser (it's broken, so many things in this program are broken, never expect anything from this program and you'll never be disappointed) type in (or paste in) the directory where you put the 'decompile' folder (there must not be a slash at the end, e.g. "C:\junk\decompile", NOT "C:\junk\decompile\").
  8. Press the Extract button.
  9. Now, because StudioCompiler is a terrible program, you need to open up the 'mdldecompiler.qc' of the decompiled model in notepad and change anything you see ending in '.dmx' to end with '.dmx.smd' instead.
  10. (All-Class Animation Sequence Hat Posing specific, skip if not relevant) Towards the end of the file, there should be a line starting with "$sequence idle "idle"", this assigns the sequence with name idle to the corresponding sequence. Simply change this to the class you want to pose, ie if I wanted to pose the alien swarm parasite on the Heavy I would change it to "$sequence idle "heavy"" and save the file.
  11. Switch to the "Model Compile" tab, go to the "Compile w/Existing QC" section, select your "mdldecompiler.qc" which you just edited and press compile. Note: If you get a compiler error about write access, it's probably because the directory the compiler wants to output to as specified in the .qc doesn't exist. Create it :D.
  12. (All-Class Animation Sequence Hat Posing specific, skip if not relevant) If all went well, you should now have replaced the idle sequence with the heavy sequence! Open up HLMV, load the heavy and the parasite to check, if it looks right, then it is right! If you need to do it for more than one class, simply change "idle" to "pyro" or "demoman" etc instead of "heavy", save the .qc and recompile.
  13. Alright you're done.

Okay so, why did you need to extract to that specific directory in the zip? The reason is because when decompiling with StudioCompiler it requires a specific directory structure to output to, but it is entirely unwilling to create missing folders itself, you have to do it. If you are missing any such folders it will throw an error and give up, if it ever does this for you just create the directory it says it cannot read from (well really you can't read a non-existent directory that's amazing StudioCompiler).

Loading more than one 'Weapon' in HLMV

So you want to load both the shotgun AND the Tyrant's Helm? "Too bad," says HLMV "you're gonna have to photoshop that shit." Not anymore! By using the registry, you can load two weapons on to a model. To continue with the above example, if I wanted to load both the Shotgun and the Tyrant's Helm on to the soldier, I would open the Registry, navigate to HKEY_CURRENT_USER>Software>Valve>hlmv>models.player.soldier.mdl then change merge0 and merge1 to "models\weapons\w_models\w_shotgun.mdl" and "models\player\items\soldier\soldier_viking.mdl". Now, after loading up the Soldier model in HLMV, bam, he's got his classy hat on AND he's holding the shotgun. There are 4 merge entries, so you can do this for 4 weapons.

  • Note: Do not try to alter registry values for a model while you currently have that model open, it won't work, load up a different model and then alter the values.
  • Note: Loading weapons in to merge slots other than 0 will cause the next model you load to inherit the merge from the previous model unless it already has a model loaded in the corresponding slot.