Extracting and Compiling VTEX files

Hello everybody. Recently, I've been looking through the .VTEX files used by most of the sprites and particle effects in-game, but I couldn't find any extensive documentation about it. Therefore, I decided to write this little guide in case anybody else finds it useful.

Extracting from VTEX

1) Extracting images from compiled VTEX files (.VTEX_C) is actually quite simple, but we need those files first. If you haven't already extracted them, you can find them in pak01_dir.vpk, which is located in your dota_ugc\game\dota_imported folder. Use a tool like GCFScape to open and extract the files that you need.

img

2) Next, go to your dota_ugc\game\bin\win64 directory (the tools aren't present in the win32 directory, for some reason). Type the following:

resourceinfo.exe -i <your vtex_c file> -debug tga -mip

This extracts the various mip maps and stores them as individual TGA images. If everything goes well, you should get something like this:

img

Additionally, you should also have one or more TGA images in your win64 directory, depending on how many mip levels the texture has. Open the one with "_mip0", as this is the base (original) image.

img

3) There is no step 3. Congratulations. You have successfully extracted the underlying TGA image from a compiled VTEX file. Easy, right?

Compiling to VTEX

1) Compiling to VTEX is also quite easy. First, put all of the TGA images you plan on using in the same directory. If you are only compiling one image, then this is not a problem. For this example though, I will be changing several of the icons in the original msg_01.vtex file.

img

2) Next, we need to create a VTEX file. VTEX files are ASCII data files which describe the properties of the texture, the inputs, and the outputs. If you created your mod from an empty template, you should find some examples of VTEX files in the dota_ugc\content\dota_addons\(modname)\materials\particle directory. Open one of them up and it should look something like this:

img

Simply replace the filename in the highlighted line ("m_fileName", under "CDmeInputTexture") with the name of your TGA image and you're set.

2b) If you're creating a texture with sequences however, you must create a .MKS file first. Like VTEX files, MKS files are ASCII data files, although these files describe how and which sprites to render in-game. Refer to the Valve Developer Wiki for more information on MKS files and animated particles in general. Note that you do NOT need to compile the MKS files with mksheet.exe first.

Once you have the .mks file, replace the filename as mentioned above with the name of the MKS file instead.

3) Go back to dota_ugc\game\bin\win64, and type the following:

resourcecompiler -i <your vtex file>

If everything goes well, you should see something like this:

img

You should also see a .VTEX_C file somewhere in your dota_ugc\game\dota_addons\(modname)\materials folder, which you can now freely use all throughout your mod.

img

Download

If you want to use the example .VTEX_C file created by this tutorial to use in your mod, you can download it here. For comparison:

img img

Bonus GIF

Comments

  • Posts: 119

    Damn thats a sick UI

    sunshine, hurricane

    all the highs & lows

  • edited January 2015 Posts: 183

    Nice guide. I could probably add a feature to D2ModKit that automates a lot of this.

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • edited January 2015 Posts: 1,668

    Wow that's really great! This opens a lot of possibilities for popups and custom particles in general, thanks a lot for sharing it.

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • DunDun
    Posts: 123

    Sorcerer CM... drools

  • omg thats fantastic

  • Posts: 183

    This has been automated in D2ModKit, thanks to XavierCHN. It needs testing though, check it out

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • edited February 2015 Posts: 183

    Worth mentioning that for decompiling, the .vtex_c files need to basically be in dota_ugc/game/dota_imported. the resourceinfo.exe doesn't like stuff pointed outside of that directory. I kept getting this error: "Unable to determine mod from file...". So for example you would extract the materials folder in the VPK to dota_ugc/game/dota_imported/materials, like HMFD did as shown in his screenshot. I pushed out an update in D2Modkit that forces this behavior, and it will transfer all the .tga's to the content/materials of your current selected addon.

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • Posts: 2

    I reverse engineered the .vtex_c format and wrote a small Linux-friendly C++ program that converts a .vtex_c file to .tga. It requires the library ImageMagick for reading the DXT1/5 compressed textures and for writing to .tga. That part can be replaced with your own image library or code.

    The GitHub wiki explains the .vtex_c file layout.

    https://github.com/tranek/vtex_c2tga

  • Posts: 1

    Hm.

    I just tried to compile something with a .vtex file, and it literally gives me this error:

    File "" doesn't exist!

    and thus fails to do anything, even though I`ve followed the steps described in the OP. Has anything been changed ever since with the Reborn beta?

  • Posts: 183

    @Selaya It still works for me. Try it with D2ModKit. It's the ".tga -> .vtex_c" button.

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • @Myll I use D2ModKit change .tga to .vtex_c and put .vtex in "game\dota_addons\myaddon\materials".But i cant find any new VTEX in the texture browser.Although i use this tutorial example .VTEX_C file,still can find anything

  • I made a mistake.i no creat a new partical so cant find VTEX...

  • Posts: 28

    @Myll

    I'm using your .vtex_c -> .tga automation. It looks like converting normal map tga doesn't bring over the channels correctly.

    I only get information in the green and Alpha(?), and just black in Red and Blue.

  • edited January 2016 Posts: 183

    As far as I know, its normal that vtex_c files are just black and white when converted to .tga. You can color them in the particle editor when you add them to .vpcf particle files. See tusk ultimate text for an example.

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

  • edited July 2017 Posts: 16

    I can't get this to work for transparency. TGA images without an alpha channel work just fine, but it dosen't work when I use images with an alpha channel. The process goes without any error warnings (whether console or D2MmodKit) but when I open the vcpf file in the particles editor I just get a black/purple checker board... Can anybody confirm that transparency works? Do I need to change something in the vtex? Can someone send me a transparent TGA that works for them, so I can check if I fucked up the process somewhere or if it's my images who are faulty? (I tried images from different sources...)

    Edit: Nevermind, solved. You have to keep in mind that Valve has restrictions on the type of TGA images you can use: https://developer.valvesoftware.com/wiki/TGA