Skip to content

Python utility converting models from Source engine to GoldSource engine. This utility can convert models with any number of polygons.

Notifications You must be signed in to change notification settings

mrglaster/S2GConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S2GConverter

Description

Python utility for converting 3D models from the Source engine to the GoldSource engine. This tool supports the conversion of models with any number of polygons and animations, making it highly versatile for modding and game development purposes. Key features include:

  • Unlimited polygon count support: Seamlessly convert models regardless of complexity or polygon count.
  • Animation preservation: Full support for importing and converting animated models.
  • Pseudo-normal map generation: Automatically generates pseudo-normal maps by combining the original texture with its derived normal map data, enhancing surface detail in GoldSource-compatible formats.
  • Texture fusion: Creates enriched textures by merging diffuse textures with normal map information, improving visual fidelity within the limitations of the GoldSource rendering pipeline.

This utility bridges the gap between modern Source-based assets and the legacy GoldSource engine, enabling developers and modders to reuse advanced models in older games with enhanced visual quality.

Installation

  1. You should have Python 3 installed
  2. Install the requirements using command
pip install -r requirements.txt
  1. Not the utility is ready to be used

Usage

  1. Place all required model files in the same directory:
  • .mdl — Main model file
  • .vvd — Vertex data
  • .vtf — Textures (VTF format)
  • .vmt — Material definition

Example structure:

/models/my_model/
├── model.mdl
├── model.vvd
├── texture.vtf
└── texture.vmt
  1. Run command
python S2GConverter.py -i "path/to/your/model.mdl" [--generate_pnmaps | --no-generate_pnmaps]

The following command line argumetns are available

Argument Type Default Description
-i, --input str (required) Path to the .mdl file you want to convert. Must include all associated Source engine assets in the same directory.
--generate_pnmaps, --no-generate_pnmaps boolean True Enables or disables pseudo-normal map generation. When enabled, the tool enhances texture detail by combining the base texture with its corresponding normal map (from the .vmt's bumpmap parameter), simulating better lighting on GoldSource’s flat shading.

You will find the converted model with name {source_model_name}_goldsource.mdl in the folder with the source model files.

Pseudo normal maps

Some older game engines like GoldSource do not support certain technologies. These technologies may include Normal Mapping - a texture mapping technique used for faking the lighting of bumps and dents. S2GConverter uses the existing normal map and process the texture, so you can get something close to the bump mapping result.

example_2

Existing restrictions

There are two situations yet, when the model can't be converted. These are:

  • The model contains sequences larger, than 64Kb.
  • The model has 129 and more bones.

Results examples

examples

Credits and Links

  1. PrimeXT - Modernized toolkit for Xash3D FWGS engine
  2. VTFLib
  3. Sources of models demonstrated here
    1. Serious Sam 2 SWEPS
    2. DOOM Eternal NPCs
    3. Dark Souls NPCs reworked