Difference between revisions of "Team Fortress Wiki:3D Models"

From Team Fortress Wiki
Jump to: navigation, search
(Needed weapons)
(Updates! Script has been cleaned up considerably. Check it out!)
Line 11: Line 11:
  
 
== Requirements ==
 
== Requirements ==
*[https://www.python.org/download/releases/2.6.6/ Python 2.6 (32-bit version)] (python-2.6.6.msi)
+
*[http://www.python.org/downloads/ Python 2.7.11 (32-bit version)] <!-- Language, 32 bit because ? -->
*[http://www.rutherfurd.net/python/sendkeys/ SendKeys] (SendKeys-0.3.win32-py2.6.exe)
+
*[http://www.pythonware.com/products/pil/ Python Imaging Library 1.1.7 (PIL)]
*[http://www.pythonware.com/products/pil/index.htm Python Imaging Library (PIL)] (PIL-1.1.7.win32-py2.6.exe)
+
*[http://www.microsoft.com/en-us/download/details.aspx?id=44266 Visual C++ Compiler for Python 2.7] <!-- SendKeys dependency -->
*[http://sourceforge.net/projects/pywin32/files/pywin32/Build216/ pywin32] (pywin32-216.win32-py2.6.exe)
+
*[http://pypi.python.org/pypi/SendKeys/0.3 SendKeys 0.3] <!-- Used to work with HLMV -->
*[http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/ NumPy] (numpy-1.6.1-win32-superpack-python2.6.exe)
+
*[http://sourceforge.net/projects/pywin32/files/pywin32/ pywin32 build 220] <!-- win32gui --> Be sure to get the win32 version!
*[http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython cython] (Cython-0.15.1.win32-py2.6.‌exe)
+
*[http://github.com/alexz-enwp/wikitools/releases/latest Wikitools 1.3] <!-- Used for file upload -->
*[http://dl.dropbox.com/u/105828/SendKeys.py Modified SendKeys.py]
+
*[http://github.com/jbzdarkid/3D-Models-automaton The automaton script]
 +
*[http://github.com/numpy/numpy/releases NumPy 1.11] <!-- Cropping images -->
 
*(''Optional'') [http://www.voidspace.org.uk/downloads/psyco-2.0.0.win32-py2.6.zip Psyco] for speed improvements (available for 32-bit Python only)
 
*(''Optional'') [http://www.voidspace.org.uk/downloads/psyco-2.0.0.win32-py2.6.zip Psyco] for speed improvements (available for 32-bit Python only)
 +
*(''Optional'') [https://pypi.python.org/pypi/poster/ Poster] if you want to upload through the script
  
 
'''OR'''
 
'''OR'''
  
*[http://www.mediafire.com/?cfc1uuwu74oyy23 Preinstalled image of the Python installation with all modules] ('''STRONGLY RECOMMENDED''')
+
*[https://www.mediafire.com/?039xmk02b2ziruk Preinstalled image of the Python installation with all modules] ('''STRONGLY RECOMMENDED''')
  
 
Also:
 
Also:
 
*[http://go.microsoft.com/?linkid=7729279 Visual C++ 2008 Express Edition with SP1] ('''Must be 2008''', more recent versions will not work. Untick SQL server option) (vcsetup.exe)
 
*[http://go.microsoft.com/?linkid=7729279 Visual C++ 2008 Express Edition with SP1] ('''Must be 2008''', more recent versions will not work. Untick SQL server option) (vcsetup.exe)
*[http://upload.gaiatools.com/files/wikitools_mod_0.7z wikitools]
 
*[http://github.com/Moussekateer/3D-Models-automaton The automaton script]
 
 
*[http://www.mediafire.com/download/2i3das2jx2v5fd6/BlackFirePlusBlackBackground.zip The background and fire textures]
 
*[http://www.mediafire.com/download/2i3das2jx2v5fd6/BlackFirePlusBlackBackground.zip The background and fire textures]
*The Source SDK
 
*The sdktools_beta
 
*[http://nemesis.thewavelength.net/index.php?p=25 GCFScape]
 
*For models that need to be recompiled: [http://steamcommunity.com/groups/CrowbarTool Crowbar].
 
  
 
== Initial setup ==
 
== Initial setup ==
 
=== Installation ===
 
=== Installation ===
* If manually installing Python:
+
* Manual python install:
** Install Python 2.6 and the required libraries (SendKeys, PIL, pywin32, NumPy and cython) and install Visual Studio Express 2008 C++ Express Edition.
+
** Install Python 2.7, Visual Studio, NumPy, and cython
** Extract the wikitools zipped file into the same directory as the script.
+
** Install SendKeys, pywin32, and PIL
** Install the Source SDK from the Tools part of Steam. This is only needed for the files, not for any of the functions!
 
** Copy the MDL Decompiler .exe to {{code|\Steam\steamapps\<username>\sourcesdk\bin\ep1\bin}}.
 
** Navigate to {{code|\Python26\Lib\site-packages}} and replace SendKeys.py with the modified version linked above.
 
 
* Otherwise extract the zipped Python folder somewhere.
 
* Otherwise extract the zipped Python folder somewhere.
 
* Download and save the automaton scripts to an easily accessible folder.
 
* Download and save the automaton scripts to an easily accessible folder.
 
* Extract the BlackFirePlusBlackBackground.zip file, and copy the contents to {{code|\Steam\steamapps\common\Team Fortress 2\tf\custom\}}.
 
* Extract the BlackFirePlusBlackBackground.zip file, and copy the contents to {{code|\Steam\steamapps\common\Team Fortress 2\tf\custom\}}.
 
* Set up HLMV to produce the highest quality images possible by following the guide found [[Help:Model_Viewer#Setup|here]].
 
* Set up HLMV to produce the highest quality images possible by following the guide found [[Help:Model_Viewer#Setup|here]].
 +
* Be sure to start TF2 at least once so that it maps your custom folders (for material overrides) and to generate gameinfo.txt.
  
 
=== Setting up automatebeta.py ===
 
=== Setting up automatebeta.py ===
 
[[File:3D Tutorial HLMV Coordinates.png|400px|thumb|HLMV screen where 1 is the location of {{code|fileButtonCoordinates}}, 2 is the location of {{code|optionsButtonCoordinates}}, and 3 is the boundary for {{code|imgCropBoundaries}}.]]
 
[[File:3D Tutorial HLMV Coordinates.png|400px|thumb|HLMV screen where 1 is the location of {{code|fileButtonCoordinates}}, 2 is the location of {{code|optionsButtonCoordinates}}, and 3 is the boundary for {{code|imgCropBoundaries}}.]]
 
 
* Open HLMV and maximize it.
 
* Open HLMV and maximize it.
 
* Take a screenshot and paste it into an image viewer such as paint.NET or Adobe Photoshop.
 
* 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.
 
* Take note of the following pixel coordinates for your screen size.
** {{code|monitorResolution}} is simply a list of your screen resolution.
 
 
** {{code|imgCropBoundaries}} is the boundary of the window the model in HLMV is contained within. The format is;  
 
** {{code|imgCropBoundaries}} is the boundary of the window the model in HLMV is contained within. The format is;  
 
*** <nowiki>[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]</nowiki>
 
*** <nowiki>[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]</nowiki>
 
*** You should leave a few pixels gap from the window edge.
 
*** You should leave a few pixels gap from the window edge.
* {{code|fileButtonCoordinates}} is a tuple of the center x,y coordinates for the File menu button in HLMV.
+
* {{code|fileButtonCoordinates}} is a tuple of the center x,y coordinates for the File menu button in HLMV. Likely, you don't have to change this.
* Close any programs that may interrupt or interfere with the process.
+
* Close any programs that may pop up or take mouse control, as they might interfere with the process.
* You are now set to take the images.
 
  
 
== Workflow ==
 
== Workflow ==
 
=== Taking images ===
 
=== Taking images ===
* Open up a weapon model in HLMV and center the model using Options Center View.
+
* Open up a weapon model in HLMV and center the model using Options &rarr; Center View.
* If the model does not face you directly when centered, it will need to be [[Team Fortress Wiki:3D Models#Recompiling models|recompiled]] with a new rotation.
+
* If the model does not face you directly when centered, it will need to be [[#Recompiling models|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.
 
* 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 [[Team Fortress Wiki:3D Models#Installation|Installation]] section on this page or the [[Help:Model_Viewer#Program_limitations|Program Limitations]] section on the Help: Model Viewer page on how to remove it.
 
 
* If the light source produces a glare that interferes with the model, hold {{Key|Ctrl}} and drag the light source around with the mouse until it is in a better position.
 
* If the light source produces a glare that interferes with the model, hold {{Key|Ctrl}} and drag the light source around with the mouse until it is in a better position.
 
* Open regedit, navigate to {{code|\HKEY_CURRENT_USER\Software\Valve\hlmv}}, and locate the registry key entry for the model. This will be in the form of {{code|models.weapons.c_models.c_wrench.c_wrench.mdl}}.
 
* Open regedit, navigate to {{code|\HKEY_CURRENT_USER\Software\Valve\hlmv}}, and locate the registry key entry for the model. This will be in the form of {{code|models.weapons.c_models.c_wrench.c_wrench.mdl}}.
* Copy and paste this key name into automatebeta.py in the model = HLMVModelRegistryKey() entry.
+
* Copy and paste this key name into automatebeta.py in the HLMVModelRegistryKey().
* Copy the {{code|Trans}} key entry for the model into automateDis as the {{code|intialTranslation}} argument. (Don't forget to add the commas to separate the values)
+
* Copy the {{code|Trans}} key entry for the model as the {{code|intialTranslation}} argument. Don't forget to add the commas to separate the values!
 
* Rotate the model by dragging near the center of the viewer.
 
* Rotate the model by dragging near the center of the viewer.
 
* There will be three possible outcomes here.
 
* There will be three possible outcomes here.
Line 76: Line 66:
 
*** Rotate the model so that it is facing left. Hold down {{Key|Shift}} and move the model sideways so that it is centered in the circle that appears.
 
*** Rotate the model so that it is facing left. Hold down {{Key|Shift}} and move the model sideways so that it is centered in the circle that appears.
 
*** Press {{Key|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 {{code|rotationOffset}} value.
 
*** Press {{Key|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 {{code|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 [[Team Fortress Wiki:3D Models#Recompiling models|recompiling models]].
+
** 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 [[#Recompiling models|recompiled]].
 
** 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 vertical '''and''' horizontal center of the model. If so, you are good to go.
 
* Set the item name in the script for {{code|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.
 
* Set the item name in the script for {{code|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 <code>python automatebeta.py</code>.
+
* Now you can run the script, from the command line. Navigate to the folder containing the scripts and type <code>python automatebeta.py</code>.
 
* You will be asked to enter the folder name for the generated images.
 
* You will be asked to enter the folder name for the generated images.
 
* 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.
 
* 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 Num Lock.
 
** To interrupt the image taking process, turn on Num Lock.
 
=== Painted hats ===
 
''Main article: [[Painted variants (tutorial)]]''
 
  
 
=== Team-colored models ===
 
=== Team-colored models ===
 
* Extract the VMTs for the model from the {{code|tf2_misc_dir.vpk}} appropriate folder directories in the {{code|/custom/folder}}.
 
* Extract the VMTs for the model from the {{code|tf2_misc_dir.vpk}} appropriate folder directories in the {{code|/custom/folder}}.
* In the automatebeta.py script, set {{code|teamColours}} to {{code|True}} and set the paths to the VMTs for {{code|REDVMTFile}} and {{code|BLUVMTFile}}.
+
* In the automatebeta.py script, set {{code|teamColours}} to {{code|True}} and set the paths to the VMTs with {{code|REDVMTFiles}} and {{code|BLUVMTFiles}}.
  
 
=== Models with other class arms/models blocking the view ===
 
=== Models with other class arms/models blocking the view ===
Line 97: Line 84:
  
 
=== Recompiling models ===
 
=== Recompiling models ===
'''For convenience, check [[Team Fortress Wiki:3D Models/Weapons|here]] to see if a model isn't already recompiled.'''
+
* First, check [[TFW:3D Models/Weapons|here]] to see if a model has already been recompiled.
 
+
* Download and install [http://steamcommunity.com/groups/CrowbarTool Crowbar], [http://nemesis.thewavelength.net/index.php?p=25 GCFScape], and the Source SDK (Steam -> Library -> Tools)
* Open the model in HLMV.
+
* Extract the model with GCFScape, decompile with Crowbar.
* Launch GCFScape and load {{code|tf2_misc_dir.vpk}}.
+
* For the most part, adding <code>$autocenter</code> to the .qc file should do the trick. If not, try using $origin X Y Z. For more complex concerns, see {{vdc|Category:QC Commands}}.
* Navigate to {{code|tf\models\weapons}} and extract the relevant weapon folder to {{code|\Steam\steamapps\common\Team Fortress 2\tf\custom\folder\models\weapons}}.
+
* Recompile the model with Crowbar. You should be good to go!
* 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 {{code|mdldecompiler.qc}} and change the $model line's value for the .dmx.smd file to not include a directory. i.e. change {{code|parts/dmx/c_wrench.dmx.smd}} to {{code|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 {{code|Compile w/Existing QC}} section, select your {{code|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:
 
** {{code|"[STEAMAPPS DIRECTORY]\common\Team Fortrees 2\bin\studiomdl" -game "[STEAMAPPS DIRECTORY]\common\Team Fortrees 2\tf" mdldecompiler.qc}}
 
* Press {{Key|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 [http://www.mediafire.com/ MediaFire]) to post on the project page.
 
 
 
'''If you run into any trouble during this process, there is a page with extra help [[User:Lexar/3d Model Viewer Tools|here]] which will list most likely difficulties of this process and explain them further'''
 
  
 
== Uploading your image for submission ==
 
== Uploading your image for submission ==
Line 122: Line 98:
 
* If something interrupts the image taking process, you can continue where you left off by setting the {{code|n}} argument in the automateDis method.
 
* If something interrupts the image taking process, you can continue where you left off by setting the {{code|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 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 {{code|True}} to just rotate the model with no tilt to see if it looks fine.
+
* You can also set the {{code|verticalRotations}} argument to {{code|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.
 
* 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.
  
Line 135: Line 111:
 
* {{icon item|Current Event Scattergun|30px}} [[Current Event Scattergun]]
 
* {{icon item|Current Event Scattergun|30px}} [[Current Event Scattergun]]
 
* {{icon item|Night Terror Scattergun|30px}} [[Night Terror Scattergun]]
 
* {{icon item|Night Terror Scattergun|30px}} [[Night Terror Scattergun]]
* {{icon item|Mutated Milk|30px}} [[Mutated Milk]]
 
* {{icon item|Batsaber|30px}} [[Batsaber]]
 
  
 
'''Soldier Weapons:'''
 
'''Soldier Weapons:'''
Line 178: Line 152:
 
* {{icon item|Low Profile SMG|30px}} [[Low Profile SMG]]
 
* {{icon item|Low Profile SMG|30px}} [[Low Profile SMG]]
 
* {{icon item|Woodsy Widowmaker SMG|30px}} [[Woodsy Widowmaker SMG]]
 
* {{icon item|Woodsy Widowmaker SMG|30px}} [[Woodsy Widowmaker SMG]]
* {{icon item|Self-Aware Beauty Mark|30px}} [[Self-Aware Beauty Mark]]
 
  
 
'''Spy Weapons:'''
 
'''Spy Weapons:'''
Line 210: Line 183:
 
* {{icon item|Bat|30px}} [[Bat|Bat: Multiple Skins]]
 
* {{icon item|Bat|30px}} [[Bat|Bat: Multiple Skins]]
 
* {{icon item|Bat Outta Hell|30px}} [[Bat Outta Hell]]
 
* {{icon item|Bat Outta Hell|30px}} [[Bat Outta Hell]]
 +
* {{icon item|Batsaber|30px}} [[Batsaber]]
 
* {{icon item|Battalion's Backup|30px}} [[Battalion's Backup]]
 
* {{icon item|Battalion's Backup|30px}} [[Battalion's Backup]]
 
* {{icon item|Bazaar Bargain|30px}} [[Bazaar Bargain]]
 
* {{icon item|Bazaar Bargain|30px}} [[Bazaar Bargain]]
Line 272: Line 246:
 
* {{icon item|Frontier Justice|30px}} [[Frontier Justice|Frontier Justice: Multiple Skins]]
 
* {{icon item|Frontier Justice|30px}} [[Frontier Justice|Frontier Justice: Multiple Skins]]
 
* {{icon item|Frying Pan|30px}} [[Frying Pan]]
 
* {{icon item|Frying Pan|30px}} [[Frying Pan]]
 +
* {{icon item|Giger Counter|30px}} [[Giger Counter]]
 
* {{icon item|Gloves of Running Urgently|30px}} [[Gloves of Running Urgently|Gloves of Running Urgently: Multiple Skins]]
 
* {{icon item|Gloves of Running Urgently|30px}} [[Gloves of Running Urgently|Gloves of Running Urgently: Multiple Skins]]
 
* {{icon item|Golden Frying Pan|30px}} [[Golden Frying Pan]]
 
* {{icon item|Golden Frying Pan|30px}} [[Golden Frying Pan]]
Line 309: Line 284:
 
* {{icon item|Medi Gun|30px}} [[Medi Gun|Medi Gun: Multiple Skins]]
 
* {{icon item|Medi Gun|30px}} [[Medi Gun|Medi Gun: Multiple Skins]]
 
* {{icon item|Memory Maker|30px}} [[Memory Maker]]
 
* {{icon item|Memory Maker|30px}} [[Memory Maker]]
 +
* {{icon item|Mutated Milk|30px}} [[Mutated Milk]]
 
* {{icon item|Necro Smasher|30px}} [[Necro Smasher]]
 
* {{icon item|Necro Smasher|30px}} [[Necro Smasher]]
 
* {{icon item|Neon Annihilator|30px}} [[Neon Annihilator]]
 
* {{icon item|Neon Annihilator|30px}} [[Neon Annihilator]]
Line 344: Line 320:
 
* {{icon item|Scotsman's Skullcutter|30px}} [[Scotsman's Skullcutter]]
 
* {{icon item|Scotsman's Skullcutter|30px}} [[Scotsman's Skullcutter]]
 
* {{icon item|Scottish Handshake|30px}} [[Scottish Handshake]]
 
* {{icon item|Scottish Handshake|30px}} [[Scottish Handshake]]
 +
* {{icon item|Self-Aware Beauty Mark|30px}} [[Self-Aware Beauty Mark]]
 
* {{icon item|Shahanshah|30px}} [[Shahanshah]]
 
* {{icon item|Shahanshah|30px}} [[Shahanshah]]
 
* {{icon item|Sharp Dresser|30px}} [[Sharp Dresser]]
 
* {{icon item|Sharp Dresser|30px}} [[Sharp Dresser]]

Revision as of 07:04, 11 May 2016

The 3D Models project's goal is to construct pseudo-3D images of the weapons in Team Fortress 2 that can be freely rotated.

Example

https://wiki.teamfortress.com/w/images/6/6a/Detonator_RED_3D.jpg?2018072610024612838,280,233,3,0,193,111,56,152,110,115,146,109,175,194,106,266,153,106,367,147,105,472,194,84,608,155,83,762,146,80,924,194,63,1098,157,60,1295,145,57,1503,194,44,1705,161,40,1932,145,35,2173,195,29,2392,165,24,2635,147,19,2895,195,20,3123,171,14,3377,151,7,3646,196,17,3872,177,11,4122,154,4,4386,198,22,4597,182,16,4829,159,9,5073,204,37,5255,188,31,5454,164,25,5663,210,61,5803,192,56,5955,168,51,6114,214,92,6203,195,89,6298,170,86,6396,215,114,6447,196,115,6497,172,115,6545,214,98,6633,195,95,6727,170,94,6825,210,78,6965,192,71,7116,168,68,7275,204,60,7457,188,49,7656,164,45,7865,198,46,8076,182,30,8308,159,25,8552,196,35,8778,177,17,9028,154,10,9292,195,31,9520,171,11,9774,151,2,10043,194,30,10263,165,12,10506,147,0,10766,194,33,10968,161,12,11195,145,2,11436,194,42,11610,157,21,11807,145,14,12015,194,58,12151,155,42,12306,146,35,12469,194,82,12560,153,72,12661,147,69https://wiki.teamfortress.com/w/images/3/36/Detonator_BLU_3D.jpg?2018072610042612842,280,232,3,0,193,111,56,153,110,114,146,110,173,194,106,264,154,106,365,146,105,470,194,84,607,155,82,761,146,80,923,194,62,1097,158,59,1294,145,56,1502,195,43,1704,162,39,1931,145,35,2172,195,28,2392,166,23,2635,148,18,2896,195,19,3125,171,14,3379,151,7,3649,196,17,3875,177,11,4125,154,4,4389,198,22,4600,182,16,4832,159,10,5076,203,37,5258,187,32,5457,164,25,5666,209,61,5806,191,57,5957,167,52,6116,213,92,6205,194,90,6299,170,87,6397,214,114,6448,195,114,6498,171,115,6546,213,98,6635,194,95,6729,170,93,6827,209,78,6967,191,70,7118,168,68,7277,203,60,7459,187,48,7658,164,44,7867,198,45,8078,182,30,8310,159,25,8554,196,35,8780,177,17,9030,154,10,9294,195,31,9523,171,11,9777,151,1,10047,195,30,10267,166,12,10510,148,0,10771,194,33,10973,162,12,11200,145,2,11441,194,42,11615,158,22,11812,145,14,12020,194,58,12157,155,42,12311,146,36,12473,194,82,12564,154,72,12665,146,69

Pictogram comment.png Note This is not for the faint of heart. It requires a bit of knowledge on how both 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

OR

Also:

Initial setup

Installation

  • Manual python install:
    • Install Python 2.7, Visual Studio, NumPy, and cython
    • Install SendKeys, pywin32, and PIL
  • Otherwise extract the zipped Python folder somewhere.
  • Download and save the automaton scripts to an easily accessible folder.
  • Extract the BlackFirePlusBlackBackground.zip file, and copy the contents to \Steam\steamapps\common\Team Fortress 2\tf\custom\.
  • Set up HLMV to produce the highest quality images possible by following the guide found here.
  • Be sure to start TF2 at least once so that it maps your custom folders (for material overrides) and to generate gameinfo.txt.

Setting up automatebeta.py

File:3D Tutorial HLMV Coordinates.png
HLMV screen where 1 is the location of fileButtonCoordinates, 2 is the location of optionsButtonCoordinates, 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.
    • 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.
  • fileButtonCoordinates is a tuple of the center x,y coordinates for the File menu button in HLMV. Likely, you don't have to change this.
  • Close any programs that may pop up or take mouse control, as they might interfere with the process.

Workflow

Taking images

  • 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 light source produces a glare that interferes with the model, hold Ctrl and drag the light source around with the mouse until 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 of models.weapons.c_models.c_wrench.c_wrench.mdl.
  • Copy and paste this key name into automatebeta.py in the HLMVModelRegistryKey().
  • Copy the Trans key entry for the model as the intialTranslation 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.
    • The model will rotate around the vertical and horizontal center of the model. If so, you are good to go.
  • 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.
  • Now you can run the script, from the command line. Navigate to the folder containing the scripts and type python automatebeta.py.
  • You will be asked to enter the folder name for the generated images.
  • 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 Num Lock.

Team-colored models

  • Extract the VMTs for the model from the tf2_misc_dir.vpk appropriate folder directories in the /custom/folder.
  • In the automatebeta.py script, set teamColours to True and set the paths to the VMTs with REDVMTFiles and BLUVMTFiles.

Models with other class arms/models blocking the view

  • If you wish to remove a model from the viewer (for example the Sniper's arms holding onto the view model Sniper Rifle), 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 /custom/folder and open them up in a text editor.
  • Inside the "VertexLitGeneric" curly brackets add the line "$no_draw" "1". This will make this part of the model invisible in HLMV.

Recompiling models

  • First, check here to see if a model has already been recompiled.
  • Download and install Crowbar, GCFScape, and the Source SDK (Steam -> Library -> Tools)
  • Extract the model with GCFScape, decompile with Crowbar.
  • For the most part, adding $autocenter to the .qc file should do the trick. If not, try using $origin X Y Z. For more complex concerns, see Category:QC Commands on the Valve Developer Community.
  • Recompile the model with Crowbar. You should be good to go!

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.
  • 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 verticalRotations 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

Weapons

Needed weapons

Scout Weapons:

Soldier Weapons:

Pyro Weapons:

Demoman Weapons:

Heavy Weapons:

Demoman Weapons:

Medic Weapons:

Sniper Weapons:

Spy Weapons:

Multiple Class Weapons:

Finished weapons