Team Fortress Wiki:3D Models
The 3D Models project's goal is to construct pseudo 3D images of the weapons in Team Fortress 2 that can be freely rotated.
Contents
Example
Note This is not for the faint of heart. It requires a bit of knowledge on how VMTs and HLMV work, and a lot of time and patience since a lot of models will not be centered correctly by default, thus requiring plenty of tweaking to get them ready for the process.
Requirements
- Python 2.6 (32-bit version) (python-2.6.6.msi)
- SendKeys (SendKeys-0.3.win32-py2.6.exe)
- Python Imaging Library (PIL) (PIL-1.1.7.win32-py2.6.exe)
- pywin32 (pywin32-216.win32-py2.6.exe)
- NumPy (numpy-1.6.1-win32-superpack-python2.6.exe)
- cython (Cython-0.15.1.win32-py2.6.exe)
- Modified SendKeys.py
- (Optional) Psyco for speed improvements (available for 32-bit Python only)
OR
Also:
- Visual C++ 2008 Express Edition with SP1 (Must be 2008, more recent versions will not work)
- wikitools
- The automaton script
- The Source SDK
- GCFScape
- For models that need to be recompiled: MDL Decompiler and StudioCompiler.
Initial setup
Installation
- If manually installing Python:
- Install Python 2.6 and the required libraries (SendKeys, PIL, pywin32, NumPy and cython) and install Visual Studio Express 2008 C++ Express Edition.
- Extract the wikitools zipped file into the same directory as the script.
- Copy the MDL Decompiler .exe to \Steam\steamapps\<username>\sourcesdk\bin\ep1\bin.
- Navigate to \Python26\Lib\site-packages and replace SendKeys.py with the modified version linked above.
- Otherwise extract the zipped Python folder somewhere.
- Download and save the automaton scripts to an easily accessible folder.
- Copy
fireLayeredSlowTiled512.vtf
to\steamapps\<username>\sourcesdk\bin\orangebox\tf\materials\effects\tiledfire
. - Copy
background.vtf
to\steamapps\<username>\sourcesdk\bin\orangebox\tf\materials\hlmv
. - Set up HLMV to produce the highest quality images possible by following the guide found here.
Setting up automate.py
fileButtonCoordindates
, 2 is the location of optionsButtonCoodinates
, and 3 is the boundary for imgCropBoundaries
.- Open HLMV and maximize it.
- Take a screenshot and paste it into an image viewer such as paint.NET or Adobe Photoshop.
- Take note of the following pixel coordinates for your screen size.
SDKLauncherStartingPoint
is a tuple of the x,y coordindates where the SDK Launcher will roughly be so the script can click on it. This can be a very rough estimate.monitorResolution
is simply a list of your screen resolution.imgCropBoundaries
is the boundary of the window the model in HLMV is contained within. The format is;- [pixel distance of left boundary from left of screen, pixel distance of top boundary from top of screen, pixel distance of right boundary from left of screen, pixel distance of bottom boundary from top of screen]
- You should leave a few pixels gap from the window edge.
fileButtonCoordindates
is a tuple of the center x,y coordinates for the File menu button in HLMV.- Close any programs that may interrupt or interfere with the process.
- You are now set to take the images.
Workflow
Taking images
- After opening the SDK Launcher, but before opening HLMV, run
hlmv-tf2.bat
– found within the zipped file – found here. This is to be done every time you open the SDK. - Open up a weapon model in HLMV and center the model using 'Options -> Center View'.
- If the model does not face you directly when centered, it will need to be recompiled with a new rotation.
- Zoom the model out so that it is as large as possible, but will not clip outside the viewer window when rotated or tilted.
- If the model has a fire overlay, see the section on dealing with team-colored models on how to remove it.
- If the light source produces a glare that interferes with the model, hold Ctrl and drag the light source around with the mouse untill it is in a better position.
- Open regedit, navigate to
\HKEY_CURRENT_USER\Software\Valve\hlmv
, and locate the registry key entry for the model. This will be in the form ofmodels.weapons.c_models.c_wrench.c_wrench.mdl
. - Copy and paste this key name into automate.py in the model = HLMVModelRegistryKey() entry.
- Copy the
Trans
key entry for the model into automateDis as theintialTranslation
argument. (Don't forget to add the commas to separate the values) - Rotate the model by dragging near the center of the viewer.
- There will be three possible outcomes here.
- The model will rotate around the bottom corner of the model. If so, you will need to make use of
rotationOffset
.- Rotate the model so that it is facing left. Hold down ⇧ Shift and move the model sideways so that it is centered in the circle that appears.
- Press F5 in HLMV, and then in regedit. Note the new 'y' Trans value. The difference between the current value and the initial value is the
rotationOffset
value.
- The model will rotate around the wrong plane or the model will not rotate around the vertical or horizontal center. If so, the model will need to be recompiled. See the section on recompiling models.
- The model will rotate around the vertical and horizontal center of the model. If so, you are good to go.
- The model will rotate around the bottom corner of the model. If so, you will need to make use of
- Set the item name in the script for
itemName
. It is suggested you initially set this to 'User <username> <item>' so you can see the item looks fine before being moved to the correct title. - The script is started as so. From the commandline, navigate to the folder containing the scripts and type
python automate.py
. - You will be asked to enter the folder name for the generated images.
- You then have 3 seconds (by default) to do the following. Click on the SDK Launcher, highlight the 'Model Viewer' entry, and then click on HLMV to bring it back into focus.
- The script will now automate taking the required images. It is best not to try and use your computer while the script is running as it will likely result in an incorrect output.
- To interrupt the image taking process, turn on Caps Lock.
Painted hats
- Coming soon
Team-colored models
- Extract the vmts for the model from the materials.gcf into the appropriate folder.
- In the automate.py script set
teamColours
toTrue
and set the paths to the vmts forREDVMTFile
andBLUVMTFile
Models with other class arms/models blocking the view
- If you wish to remove a model from the viewer (for example the Spy's arms holding onto the viewmodel Electro Sapper), click on the Model tab in HLMV and find out which VMTs are being used for the model textures.
- Extract the VMTs using GCFScape to the same path in your 'team fortress 2 folder' and open them up in a text editor.
- Inside the
"VertexLitGeneric"
curly brackets add the line"$no_draw" "1"
. This will make the model invisible in HLMV.
Recompiling models
- Open the model in HLMV.
- Launch GCFScape and load 'team fortress 2 materials.gcf'.
- Navigate to
tf\models\weapons
and extract the relevant weapon folder to\Steam\steamapps\<username>\team fortress 2\tf\models\weapons
. - Launch MDL Decompiler, tick "do not fix rotations on animations", set your output directory to the same folder where the model was extracted, and extract.
- Unfortunately, you are not done. The animation sequences you have just decompiled are all horribly borked. Launch StudioCompiler, go to the Model Decompile tab, and decompile the same model (this time leaving "do not fix rotations" unticked). The decompiler will throw you an error. That is fine. Click okay and it will finish extracting. Make sure you output to the SAME directory as the previous step so that the files will be overwritten.
- Open up the outputted "mdldecompiler.qc" and change the $model line's value for the .dmx.smd file to not include a directory. i.e. change "parts/dmx/c_wrench.dmx.smd" to "c_wrench.dmx.smd".
- Open up idle.smd in a text editor. You will find an entry/entries that start with time 0/1/etc. The 2nd/3rd/4th numbers in the entry correspond to back/forth, side to side, and up/down translations, respectively. The 5th/6th/7th numbers in the entry correspond to x, y, and z rotations, respectively. Correct these values for all lines (or delete the all the time lines except for the first) and save.
- Go back to StudioCompiler, go 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 is probably because the directory that the compiler wants to output to as specified in the .qc doesn't exist. Create it.
- Note: If StudioCompiler is crashing or otherwise fails to compile, you can compile manually (which is faster too). Open the command line to the directory with your "mdldecompiler.qc" and enter:
"[STEAMAPPS DIRECTORY]\sourcesdk\bin\orangebox\bin\studiomdl" -game "[STEAMAPPS DIRECTORY]\team fortress 2\tf" mdldecompiler.qc
- Press F5 in HLMV to refresh the model state. If the model still does not rotate in the correct plane/center of the model, change the values again and recompile. This may require a lot of trial and error.
- After successfully recentering the model, copy the recompiled .mdl, .vtx, .phy, and .vvd files into a zipped folder and upload to a file sharing site (preferably MediaFire) to post on the project page.
Uploading your image for submission
- Post a link to the image on the Talk page under a section titled after the weapon's name, along with your parameters for the script (weapon key name, initial rotation, initial translation, offsets, etc).
- Keep a copy of the individual frame images somewhere safe in case they are needed in the near future.
Tips and debugging
- If your HLMV is opening too slowly, adjust the time in the
mouse.sleep(time in seconds)
entry that follows opening HLMV. - Stick the SDK Launcher near the top left of your screen to speed up the step as the script will start looking for the button there by default (this can be changed).
- If something interrupts the image taking process, you can continue where you left off by setting the
n
argument in the automateDis method.- You can also use this to check the images are coming out right by interrupting the script and checking the images. If the rotation looks okay, continue where you left off.
- You can also set the disableXRotation argument to
True
to just rotate the model with no tilt to see if it looks fine. - You will find it much easier when recompiling models to find out if they're centered correctly by checking the 'Ground' checkbox in HLMV and refreshing the model every time you make a change and recompile.
Models repository
Hats
Needed hats
Note: Reserve the hat you are working on by placing the line '{{c|info}} - Reserved by [[User:<username>|<username>]]' on the relevant hat line. If you have any problems with a model, please post on the Talk page under a section titled after the hat's name.
A Rather Festive Tree
Alien Swarm Parasite - '
Info - Reserved by Haze
Amber's Rad As All Hell Hat
Anger -
Info - Reserved by Ragnar Homsar
Aperture Labs Hard Hat
Armored Authority -
Info - Reserved by Ragnar Homsar
Athletic Supporter
Attendant
Backbiter's Billycock
Backwards Ballcap
Baseball Bill's Sports Shine -
Info - Reserved by Henry Spencer
Batter's Helmet
Benefactor's Kanmuri -
Info - Reserved by Fashnek
Berliner's Bucket Helm
Big Chief
Big Country
Bill's Hat
Blazing Bull
Bloke's Bucket Hat
Bombing Run
Bonk Boy
Bonk Helm
Info - Reserved by Mr. Magoolachub
Bounty Hat
Brain Bucket
Brainiac Goggles
Brainiac Hairpiece
Brigade Helm
Bubble Pipe
Buccaneer's Bicorne
Buckaroos Hat
Buzz Killer
Cadaver's Cranium
Can Opener
Capo's Capper -
Info - Reserved by Ragnar Homsar
Carouser's Capotain
Charmer's Chapeau
Cheater's Lament
Chieftain's Challenge
Clockwerk's Helm
Cold War Luchador
Company Man
Conjurer's Cowl
Connoisseur's Cap
Copper's Hard Top
Cosa Nostra Cap -
Info - Reserved by Henry Spencer
Counterfeit Billycock
Coupe D'isaster
Crocleather Slouch
Dead Cone
Dealer's Visor
Defiant Spartan
Demoman's Fro
Desert Marauder
Doctor's Sack
Dr's Dapper Topper -
Info - Reserved by Henry Spencer
Dragonborn Helmet
Dread Knot
Détective Noir -
Info - Reserved by Ragnar Homsar
Einstein
El Jefe -
Info - Reserved by Fashnek
Ellis' Cap
Engineer's Cap -
Info - Reserved by Ragnar Homsar
Exquisite Rack
Familiar Fez
Fancy Fedora -
Info - Reserved by Ragnar Homsar
Flipped Trilby -
Info - Reserved by Ragnar Homsar
Football Helmet
Foster's Facade
Frenchman's Beret -
Info - Reserved by Ragnar Homsar
Frontline Field Recorder -
Info - Reserved by Fashnek
Full Head Of Steam
Furious Fukaamigasa
Geisha Boy
Gentleman's Gatsby -
Info - Reserved by Henry Spencer
German Gonzila
Ghastlier Gibus -
Info - Reserved by Fashnek
Ghastlierest Gibus -
Info - Reserved by Fashnek
Ghastly Gibus -
Info - Reserved by Fashnek
Glengarry Bonnet
Grenadier's Softcap
Grimm Hatte
Gym Rat
Halloween Masks
Hair of the Dog
Handyman's Handle
Hard Counter
- Error creating thumbnail: Unable to save thumbnail to destinationHat of Undeniable Wealth And Respect
Heavy Duty Rag
Hermes
Hero's Hachimaki -
Info - Reserved by Fashnek
Hero's Tail
Hetman's Headpiece
Holy Hunter
Honcho's Headgear
Horrific Headsplitter
Horseless Headless Horsemann's Head
Hot Dogger
Hotrod
Hottie's Hoodie
Hound Dog
Humanitarian's Hachimaki
Hustler's Hallmark
Idiot Box
Industrial Festivizer
Infernal Impaler
J.Axer's Dapper Topper
Janissary Ketche
Jumper's Jeepcap
Killer Exclusive -
Info - Reserved by Ragnar Homsar
Killer's Kabuto
Large Luchadore -
Info - Reserved by Ragnar Homsar
Larrikin Robin
Little Buddy
Lo-Fi Longwave
Lord Cockswain's Pith Helmet
Lumbricus Lid
Madame Dixie
Magistrate's Mullet
Magnanimous Monarch -
Info - Reserved by Fashnek
Magnificent Mongolian
Mann Co. Cap
Manniversary Paper Hat
Mask of the Shaman -
Info - Reserved by Fashnek
Master's Yellow Belt
Max's Severed Head -
Info - Reserved by Ragnar Homsar
Medic's Mountain Cap
Mildly Disturbing Halloween Mask
Milkman
Mining Light
Modest Pile of Hat -
Info - Reserved by jjkoletar
MONOCULUS!
Moonman Backpack
Nanobalaclava
Napper's Respite
Noble Amassment of Hats
Noh Mercy
Officer's Ushanka
Ol' Geezer
Ol' Snaggletooth
Old Guadalajara -
Info - Reserved by Ragnar Homsar
One-Man Army
Otolaryngologist's Mirror
Outdoorsman
Party Hat
Pencil Pusher
Pilotka
Planeswalker Helm
Prancer's Pride
Prince Tavish's Crown
Private Eye
Professional's Panama
Professor's Peculiarity
Proof of Purchase
Prussian Pickelhaube
Pugilist's Protector
Pyro's Beanie -
Info - Reserved by Ragnar Homsar
Pyromancer's Mask
Reggaelator
Respectless Rubber Glove
Rimmed Raincatcher
Ritzy Rick's Hair Fixative -
Info - Reserved by Henry Spencer
Safe'n'Sound
Salty Dog
Samur-Eye
Saxton Hale Mask
Scotch Bonnet
Scotsman's Stove Pipe
Seal Mask
Sergeant's Drill Hat
Shooter's Sola Topi
Sniper's Snipin' Glass
Sober Stuntman -
Info - Reserved by Fashnek
Soldier's Stash
Spine-Chilling Skull
Spiral Sallet
Stahlhelm
Stainless Pot
Stately Steel Toe
Storm Spirit's Jolly Hat
Stout Shako
Sultan's Ceremonial
Summer Hat
Surgeon's Stethoscope
Superfan
Tam O' Shanter -
Info - Reserved by Fashnek
Tavish DeGroot Experience
Team Captain -
Info - Reserved by Ragnar Homsar
Texas Slim's Dome Shine -
Info - Reserved by Henry Spencer
Texas Ten Gallon
Tippler's Tricorne
Tough Guy's Toque - Reserved by Mr. Magoolachub
Towering Pillar of Hats
Treasure Hat
Triboniophorus Tyrannus -
Info - Reserved by Ragnar Homsar
Trophy Belt
Troublemaker's Tossle Cap
Tyrant's Helm
Uncle Sam
Under Cover
Vintage Merryweather
Vintage Tyrolean
Voodoo Juju
Western Wear
Whoopee Cap
Wiki Cap -
Info - Reserved by iamtehlolrus
World Traveler's Hat -
Info - Reserved by Henry Spencer
Wrap Battler
Ye Olde Baker Boy
Info - Reserved by Mr. Magoolachub
Your Worst Nightmare
Ze Goggles
Apparition's Aspect
Ball-Kicking Boots
B-ankh!
Big Steel Jaw of Summer Fun
Birdcage
Blighted Beak
Bombinomicon
Bronze Dueling Badge
Builder's Blueprints
Camera Beard
Companion Cube Pin
Dangeresque, Too?
Dashin' Hashshashin
Deus Specs
Dr. Gogglestache
Dr. Grordbort's Crest
Dr. Whoa
Earbuds
Emerald Jarate
Essential Accessories
Fallen Angel
Fancy Dress Uniform -
Info - Reserved by Ragnar Homsar
Flip-Flops
Frontier Flyboy
Futankhamun
Garlic Flank Stake
Gentle Manne's Service Medal
Gold Dueling Badge
Googly Gazer
Griffin's Gog
Grizzled Veteran
Hat With No Name
Intangible Ascot
Last Breath
Le Party Phantom
Legend of Bugfoot
License to Maim
Lord Cockswain's Novelty Mutton Chops and Pipe
Lucky No. 42
Made Man
Mark of the Saint
Mercenary
Merc's Pride Scarf
Physician's Procedure Mask -
Info - Reserved by Henry Spencer
Pickled Paws
Pip-Boy
Planeswalker Goggles
Info - Reserved by Mr. Magoolachub
Platinum Dueling Badge
Pocket Medic
Point and Shoot
Polycount Pin
Prairie Heel Biters
Primeval Warrior
Professor Speks
Purity Fist
Resurrection Associate Pin
Rogue's Col Roule
Scottish Snarl
Security Shades
Shoestring Budget
Sight for Sore Eyes
Sign of the Wolf's School
Silver Bullets
Silver Dueling Badge
Soldier of Fortune
Soviet Stitch-Up
SpaceChem Pin
Steel Pipes
Steel-Toed Stompers
Stockbroker's Scarf
Summer Shades
Surgeon's Stahlhelm
Tail From the Crypt
Teddy Roosebelt
- Tournament Medal - ETF2L Highlander Tournament
- Tournament Medal - GWJ Tournament
- Tournament Medal - UGC Highlander Tournament
Villain's Veil
War Head
Whiskered Gentleman
Wingstick
Finished hats
Weapons
Needed weapons
Note: Reserve the weapon you are working on by placing the line '{{c|info}} - Reserved by [[User:<username>|<username>]]' on the relevant weapon line. If you have any problems with a model, please post on the Talk page under a section titled after the weapon's name.
Finished weapons
Ali Baba's Wee Booties
Ambassador
Amputator
Apoco-Fists
Atomizer
Axtinguisher
Backburner
Back Scratcher
Bat
Battalion's Backup
Bazaar Bargain
Big Earner
Big Kill
Black Box
Black Rose
Blutsauger
Bonesaw
Bonk! Atomic Punch
Bootlegger
Boston Basher
Bottle
Brass Beast
Buffalo Steak Sandvich
Buff Banner
Build tool
Bushwacka
Candy Cane
Chargin' Targe
Claidheamh Mòr
Cloak and Dagger
Concheror
Conniver's Kunai
Conscientious Objector
Cow Mangler 5000
Crit-a-Cola
Crusader's Crossbow
Dalokohs Bar
Darwin's Danger Shield
Dead Ringer
Degreaser
Demolish tool
Detonator
Diamondback
Direct Hit
Disciplinary Action
Disguise Kit
Electro Sapper
Enforcer
Enthusiast's Timepiece
Equalizer
Eureka Effect
Eviction Notice
Eyelander
Family Business
Fan O'War
Festive Bat
Festive Flamethrower
Festive Minigun
Festive Rocket Launcher
Festive Stickybomb Launcher
Fire Axe
Fishcake
Fists
Fists of Steel
Flamethrower
Flare Gun
Force-A-Nature
Frontier Justice
Frying Pan
Gloves of Running Urgently
Golden Wrench
Grenade Launcher
Gunboats
Gunslinger
Half-Zatoichi
Holiday Punch
Holy Mackerel
Homewrecker
Horseless Headless Horsemann's Headtaker
Huntsman
Invisibility Watch
Iron Curtain
Jag
Jarate
Killing Gloves of Boxing
Knife
Kritzkrieg
Kukri
L'Etranger
Liberty Launcher
Loch-n-Load
Lugermorph
Machina
Mad Milk
Manmelter
Mantreads
Market Gardener
Maul
Medi Gun
Minigun
Natascha
Nessie's Nine Iron
Original
Overdose
Pain Train
Persian Persuader
Phlogistinator
Pistol
Pomson 6000
Postal Pummeler
Powerjack
Quick-Fix
Razorback
Reserve Shooter
Revolver
Righteous Bison
Rocket Jumper
Rocket Launcher
Sandman
Sandvich
Saxxy
Scattergun
Scotsman's Skullcutter
Scottish Handshake
Scottish Resistance
Shahanshah
Sharp Dresser
Sharpened Volcano Fragment
Short Circuit
Shortstop
Shotgun
Shovel
Sniper Rifle
Soda Popper
Solemn Vow
Southern Hospitality
Splendid Screen
Spy-cicle
Stickybomb Launcher
Sticky Jumper
Submachine Gun
Sun-on-a-Stick
Sydney Sleeper
Syringe Gun
Third Degree
Three-Rune Blade
Tomislav
Tribalman's Shiv
Übersaw
Ullapool Caber
Unarmed Combat
Vita-Saw
Wanga Prick
Warrior's Spirit
Widowmaker
Winger
Wrangler
Wrap Assassin
Wrench
Your Eternal Reward