Skip to content

jbzdarkid/3D-Models-automaton

 
 

Repository files navigation

3D Models automaton

This repository houses the scripts to create pseudo-3D images for the TF2 wiki. For more information, see the 3D Models project page.

Requirements

Installation steps

  1. Install Windows
  2. Install TF2
  3. Extract 3D-Models-automation.zip to an easily accessible folder.
  4. Follow the HLMV setup instructions
    • Be sure to set up the VMT replacement textures (linked in the Program limitations section) or you can find the files in this repository.
  5. Launch TF2 so that it maps your custom folders (for material overrides) and generates gameinfo.txt.
  6. Set up Python
    a. Install Python 3.7.9
    b. Open Powershell
    c. cd to the extracted 3D-Models-automaton folder
    d. Run python -m venv venv (may take a few seconds)
    e. Run ./venv/scripts/activate
    f. Run pip install -r requirements.txt
  7. Run the automate script
    a. Open HLMV (or HLMV++)
    b. Load your model, center view, and zoom until it is a reasonable size
    c. Run python automate.py
    d. Wait for the script to rotate and screenshot the model. Do not switch away from HLMV during this time.
    e. Wait for the script to blend the images.
    f. Enter the name of your file. When testing, you should prefix your images with User Username, e.g. User Darkid Test
    g. Enter your username.
    h. Enter your password. Even though no characters will appear, the terminal is still reading your inputs.
    i. Wait for your file to upload.
    j. If login or upload fails, the script will save your image (and the template) to temp.jpg and temp.txt. You can upload them manually if you wish.

For further instructions, see TFW:3D Models

Troubleshooting

Unable to create a virtual environment in (6d) because "the command [...] returned non-zero exit status 1."

This usually indicates that python has been installed improperly. Please uninstall python (search for "Add or remove programs") and then reinstall it using the link in (6a). If possible, install python for all users, and if you still encounter this issue, try running Powershell again using an administrator.

Unable to activate the virtual environment in (6e) because "the execution of scripts is disabled on this system"

For your safety, Windows by default does not allow execution of non-Microsoft powershell scripts (such as python's virtual environment).

To disable this for the current powershell session, run:

Set-ExecutionPolicy Unrestricted -Scope Process

To disable this forever, run:

Set-ExecutionPolicy Unrestricted -Force

Note that you may need to run Powershell as an administrator to execute these commands.

Unable to install requirements in (6f) because "No matching distribution found for numpy==1.21.6"

Unfortunately, this codebase requires a specific, older version of python. Please uninstall python (search for "Add or remove programs") and then reinstall it using the link in (6a).

The automate script fails during (7c) with an error like "Unable to determine HLMV/HLMV++ version, please recompute sigscans"

Please reach out to me if this happens. This usually means that the model viewer has had significant engine changes, and will require additional work from me to get it working again. In the mean time, consider using an older copy of the model vewier (if possible)

The automate script fails during (7c) with an error like "Couldn't find HLMV, is it open with a model loaded?"

The script relies on the window title to identify HLMV (or HLMV++).
If HLMV is open and you've loaded a model, the title should be something like models\weapons\w_models\w_bonesaw.mdl
If your models are hosted somewhere else (or, for some reason, your title is different), open automate.py in a text editor and change this line:

    if 'models' in window_title or "Jed's Half-Life Model Viewer" in window_title:

to something which matches your window's title, e.g.:

    if 'models' in window_title or "D:\\Modelling" in window_title:

Note: You must use \\ to represent a single \.
Note: You must preserve the 4 leading spaces before the if.

The 3D image is not removing the HLMV window borders

The imageprocessor.py script will attempt to automatically detect the bounds of the HLMV viewport. This is not bulletproof and may fail with an error like "IndexError: index 0 is out of bounds for axis 0 with size 0"

If you have having trouble, you can manually edit the bounds_override variable in automate.py. For example, on my 3840x2100 monitor, I use these bounds:

bounds_override = (2, 70, 3838, 1730)

You can open this file in any text editor and simply change the code. It may take some trial and error to find the correct values.

If you would like to remove the override and restore the automatic processing, simply set all the values to 0:

bounds_override = (0, 0, 0, 0)

Further questions

If you are experiencing issues with the model itself (the way it looks or rotates), please take a look at the notes on the TFW:3D Models page.

If you are still having trouble, you can leave me a message on the TF2 wiki, add me on steam, open a GitHub issue, or send a message by carrier pigeon (they know where I live).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 76.4%
  • C++ 23.6%