S&box Wiki

Revision Difference

source_1_assets_porting#547283

<cat>Dev.Material</cat> <title>Source 1 Material Porting</title> <note>The "Character" Shaders from Counter-Strike: Global Offensive will not work properly with this method. You will not get the same results like in CS:GO. The "character" shader in CS:GO, is a Source 2 thing put inside Source 1, similar to the Dota 2 materials, which uses Source 2 format. Which the script does not support, also note it is still "buggy", also is not included in the README. See: * [$masks1](https://developer.valvesoftware.com/wiki/$masks1) * [$masks2](https://developer.valvesoftware.com/wiki/$masks2) * [Material Editor](https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Materials/Material_Editor) </note> <validate> Move this page to "Porting multiple Materials from Source 1 Games at once", or similar? Is this method appropriate or does Material Editor support multiple files? </validate> ⤶ # Things you’ll need:⤶ ##To convert the textures:⤶ ⤶ [VTFEdit](https://nemstools.github.io/pages/VTFLib.html) ⤶ ##To convert the materials:⤶ ⤶ [Python 3](https://www.python.org/downloads/)<br/>⤶ [realpack/source2utils](https://github.com/realpack/source2utils) (Read the README) ⤶ ##To extract assets from .vpk and .bsp:⤶ ⤶ [GCFScape 1.8.6](https://nemstools.github.io/pages/GCFScape.html)⤶ ⤶ # To do:⤶ ⤶ 1. Gather all of our materials in a folder with the default material structure - materials/*<br/>⤶ 2. Convert .VTFs to .TGAs<br/>⤶ 3. By using [realpack/source2utils](https://github.com/realpack/source2utils), convert our .VMTs to .VMATs<br/>⤶ 4. Move the converted files to the content folder of your target add-on - steamapps/common/Half-Life Alyx/content/*/materials⤶ ⤶ #To convert and import the textures:⤶ ⤶ + [source1import](https://github.com/kristiker/source1import)⤶ ⤶ + the gameinfo.txt from the source 1 game your importing from. ⤶ #To convert the materials⤶ ⤶ ###Step 1⤶ ⤶ + place the gameinfo.txt in in a folder with your materials that you will be importing. ⤶ <upload src="a768a/8da73da8e2cbd34.png" size="11106" name="explorer_s31lyKDE1D.png" />⤶ ⤶ ###Step 2⤶ ⤶ + Click on the three `...` to the right of "import game" Browse to the materials that you will be importing.⤶ ⤶ + Tick `Import Textures` & `Import Mateials`.⤶ ⤶ + Click on go.⤶ ⤶ <upload src="a768a/8da73db3dcebc83.png" size="62719" name="source1import_ubGRDq8dPp.png" />⤶ # Gathering the files⤶ ⤶ Gather all of our materials in a folder with the default material structure:⤶ ###example:⤶ ```⤶ .⤶ └── css/⤶ └── materials/⤶ ├── bricks⤶ ├── building_template⤶ └── cable⤶ ```⤶ # Converting the textures⤶ By using a handy-dandy VTFEdit feature called “Convert folder”, we are going to batch convert all the .VTFs to .TGAs.⤶ ⤶ Open VTFEdit, choose Tools/Convert folder. Select the Input and Output folders, and copy the rest settings as shown.⤶ ⤶ ![VFTEdit](https://aws1.discourse-cdn.com/business20/uploads/facepunch1/original/3X/e/0/e0c2ceb24aa00aa2527afcf37cbc7f98a08a3bda.png)⤶ # Converting .VMTs to .VMATs⤶ Install [Python 3](https://www.python.org/downloads/) and download the [realpack/source2utils](https://github.com/realpack/source2utils) repository as .zip.⤶ <br/>⤶ Extract the .zip archive, open and go to source2utils/utils. By pressing File/Open Windows Power Shell on Windows Explorer, open Windows Powershell.⤶ ⤶ ![Open Powershell](https://aws1.discourse-cdn.com/business20/uploads/facepunch1/original/3X/a/a/aa311e5653738936ae53b5b2e8f012c92caf9ff0.png)⤶ ⤶ Once open, Install Pillow by entering this command:⤶ pip install Pillow⤶ ⤶ Once installed, start vmt_to_vmat.py by entering:⤶ python.exe .\vmt_to_vmat.py⤶ ⤶ ![Powershell](https://aws1.discourse-cdn.com/business20/uploads/facepunch1/original/3X/9/b/9b4cfe28559cdb6e12f149625ef2b52c30d74b50.png)⤶ ⤶ You are now going to be asked to specify what folder would you like to convert. To get the valid format of the materials folder, select the materials folder by clicking once on it, and press the Copy Path button located in the Home tab on Windows Explorer.⤶ ⤶ ![File Explorer](https://aws1.discourse-cdn.com/business20/uploads/facepunch1/original/3X/2/f/2fa7095ef6a7ae9d58b9950b78ab43eeeefc66c2.png)⤶ ⤶ You have just saved the path of the folder. Paste it into the Windows Power Shell window, but don’t forget to remove the quotation marks⤶ <br/><br/>⤶ D:\Users\*\Desktop\css\materials, not "D:\Users\*\Desktop\css\materials".⤶ ⤶ ###You are now going to need to select:⤶ ```⤶ ```html⤶ Would you like to overwrite any existing .vmat files? (y/n): - Y⤶ Would you like to overwrite any existing .tga files? (y/n): - Y⤶ What is your target shader? Valid Options: vr_complex (vr_standard support coming soon) - vr_complex⤶ ```⤶ And you are done!⤶ ⤶ # Moving Files⤶ ⤶ You are now going to notice a new folder: *_imported. It is going to contain all of the newly ported materials ready for Source 2! But we are still not done, we need to add them to the game!⤶ # Moving Files⤶ ⤶ You are now going to notice a new folder: *_imported next to the folder that you put your original files into. It is going to contain all of the newly ported materials ready for Source 2! But we are still not done, we need to add them to the game!⤶ To do so, copy the materials folder to your created add-ons folder or the game content folder located at steamapps/common/Half-Life Alyx/content/materials If done correctly, all of them should show up in the Source Workshop Tools Assets list! ![Asset Browser](https://aws1.discourse-cdn.com/business20/uploads/facepunch1/original/3X/a/e/aec7a1e2d7565f6db875faf084c72dd93e866459.jpeg) cs_assault materials ported from Counter-Strike: Source. # Credits Original guide made by user *[noonforme](https://forum.facepunch.com/u/noonforme)* can be found [here](https://forum.facepunch.com/t/texture-and-material-porting-to-source-2/242845) on the Facepunch forums.