Friday, May 11, 2012

Beginner's Guide to Custom Colors in SFxT


Update: The steps from this tutorial have been automated. You can now do all of it easily from sloth86's EMMEdit tool.

Street Fighter x Tekken handles colors in a completely different way from Street Fighter 4 and its derivatives as a result of the color customization feature. Instead of just pulling colors and textures directly from the texture image, the textures look like this:
and the game calculates the appropriate color based on a series of numbers, which represent a color mix from the texture image's color channels. These numbers are stored in the *.obj.emm files--specifically the 'MatCol' attributes--alongside the various other object materials and material attributes.

There are two main ways to edit *.obj.emm files, manually via hex or using NanjouJ's MatEdit tool, which is a little more user-friendly than fiddling with hex codes. In this tutorial, we'll be using MatEdit to copy colors from another color file, rather than calculating the color from scratch. If you would like to calculate an entirely new color from scratch, this post from yajirobe does a good job of explaining it.

So, first thing, we need to make backups of any of the files we plan to mess with. Once you've done that, go download MatEdit from the AE wiki's 'tools' page and identify which files you want to work with. I'm going to be copying a color from one of Ryu's *.obj.emm files into one of Poison's.

Now, create a new folder (on your desktop or wherever) and copy matedit.exe and both Ryu and Poison's *.obj.emm files into it. Then, hold ctrl+shift on your keyboard and right-click somewhere inside that folder, and choose 'Open command window here':

 This will open a command line window, but don't freak out. I'm going to tell you exactly what to type in.

First thing, we want to export the materials from both of our files, using the syntax "matedit.exe export [target obj.emm file] [newfile.txt]." So, in my case, I'm going to type (replace PSN/RYU and poison/ryu as appropriate for your files):
matedit.exe export PSN_01_01.obj.emm poison.txt
and
matedit.exe export RYU_01_01.obj.emm ryu.txt
If done correctly, you should have two new files in your directory, in my case, poison.txt and ryu.txt. At this point, we're done with the command line for now, but don't close it yet because we're going to need it again later.

For now, open both files in the text editor of your choice. Notepad works, but I prefer Notepad++ (it's free and awesome; go get it).

Open both of the txt files in your text editor. You'll see a series of sections which correspond to the various objects that make up the character's model. In each section, there are a bunch of variables and values that tell the game how to render each object. The ones we're worried about today are the MatCol variables:
 You'll notice that I highlighted just the *R, *G and *B MatCols, which correspond to the red, green and blue color channels, respectively, and not the *A MatCol, which corresponds to the Alpha channel. You shouldn't mess with the alpha value if you're just trying to change colors. ;)

So, lets say we want to take the color of Ryu's pants--i.e., white--and copy it over to Poison's hair. To do this, we would hop over to our ryu.txt file and search for 'pants.' Then, scroll down through his 'pants' section until we find the MatCol subsection.
 In this case, I only have a single color, MatCol0 to choose from, but some models will have multiple color groups, such as MatCol1 and MatCol2. These MatCols represent the color groups that can be customized in-game, so make sure you're choosing the correct one.

Copy those values and then switch over the poison.txt file and search for 'hair.' Scroll down to the MatCol section and replace the values there with your new, copied values:
 Great, we're almost done.

The last step is to import the modified text files back into the target *.obj.emm file. So, back to your command line window (if you didn't listen earlier and closed it, just open a new one) and type:
matedit.exe import poison.txt PSN_01_01.obj.emm
Now you're ready to test it out. Copy the PSN_01_01.obj.emm file into your [install directory]\resource\CMN\battle\chara\PSN folder, overwriting the one that was there (you made a backup, right??) and go check it out.

If you had calculated a new color from scratch using yajirobe's instructions instead of copying the color from some other costume, you would go through the exact same steps, only using your calculated color numbers instead of the ones from Ryu's pants.

That's it. Have fun, share your work and always make backups.

Analytics Tracking Footer