Thursday, October 21, 2010

Beginner's Guide to SF4 Skinning

There are several tutorials floating around for skinning in Street Fighter 4, namely those by Providenceangle and hornyyoshi, but they were both written fairly early on and have not been updated to reflect new, easier methods. So, here is a definitive guide to creating new skins in SF4:

1. Collecting the Tools

First and foremost, you'll need a painting program. Photoshop is obviously quite common but also very expensive. GIMP is a free alternative that works quite well (it's what I usually use) and you can download it free from here. This tutorial will mainly focus on Photoshop, but I'll include some info for GIMP when possible.

Next, you'll need a plugin for your paint program to allow you to open/modify DDS textures, which are used by SF4. For Photoshop, you can use Nvidia's free Photoshop plugin, available here. If you would rather use free software, GIMP has a DDS plugin available here. I'm not going to cover installing the plugins, but you should be able to find documentation at the respective sites.

You'll also want to download Nvidia's free Windows Texture Viewer tool, which will give you some valuable information about the DDS textures you will extract. You can download it here.

Finally, you'll need to download the latest version of piecemontee's Asset Explorer, which greatly simplifies the whole modding process, from decompressing files to identifying, viewing, extracting and injecting textures. It does it all and you can download it from here.

2. Some basic information

Vanilla SF4 uses two main files to control the appearance of a character:

A. The cos file (stands for costume), which is designated by the character's three-letter name abbreviation (ZGF for Zangief, RYU for Ryu, etc.), a number delineating which costume (01 for original, 02 for Capcom's alternate), the file extension (cos) and the compression container (emz). So, Zangief's original costume will be named ZGF_01.cos.emz.

B. The col file (stands for color), which is similarly designated by the character's three-letter name abbreviation, a number designating which cos file the color goes with (i.e., original costume or alternate), a number delineating which color slot the file occupies (one through ten), the file extension (col) and the compression container (again, emz). So, Zangief's first color for his original costume will be named ZGF_01_01.col.emz.

The cos files primarily contain the 3D model and other embedded files used by the engine to display the body that you see in-game. I won't cover editing any of these files here, but I wanted to mention it anyway.

For simple skinning, you will be entirely focused on the col files, which contain embedded texture files stored in DDS format (hence the need for a DDS plugin).

In AE, the *.emz containers are no longer used, so all of the component files are just sitting inside the character's directory. 3D models are stored in the ***.obj.emo file, while textures are stored in the ***.col.emb file.

3. Using piecemontee's Asset Explorer

The Asset Explorer is the cornerstone of the modding process and it takes the place of offzip, Dragon Unpacker and Infuser, all of which are difficult to use and can be scary for would-be modders.

So, just open up the Asset Explorer and drag a cos file and a corresponding col file which you wish to edit into its left-hand pane. In AE, you would drag over an ***.obj.emo model and a ***.col.emb texture file.

Now, expand the entries for the cos file until you see and entry that says #EMO (HND_01.obj.emo) (HND will be replaced with your character's three-letter abbreviation) and highlight it. As you can see, the program will then load the costume model, which will appear spooky and gray (this is the ambiant occlusion map; nothing to concern yourself with, but I thought I'd mention it for completeness):
To see the col textures applied to the model, use the pulldown menu in the middle of the window to select an option that displays 'texture' (the one at the bottom, 'Shadowed + Ink Shader + Texture + Normal Map' looks the closest to what you would see in-game):
Throughout the skinning process, you can use this to preview your work without loading up the entire SF4 program just to check a small detail.

4. Extracting Textures

Back in the left-hand pane of the Asset Explorer, expand the col file structure (and the entry labeled #EMB (HND_01_01.col.emb)) until you see one or more entries named 'DDS.' If you click on it, the preview window will change to display the texture file:
Once the desired DDS is selected, if you right-click on the DDS entry, you'll see a contextual menu with an option to 'Extract...' Choose it and you will be offered a chance to save the extracted texture as a standalone DDS file. This is what we'll be editing in our paint program and then re-injecting later, so I like to name it something that will tell me its position in the DDS order later, such as "ryu-bag-1.dds" or whatever. At this point, I also like to make a backup of the original DDS texture for future reference.

5. Painting Your Skin

When you open your extracted DDS texture(s) in your paint program, be it Photoshop or GIMP, it will bring up a dialog box asking you some questions. It's fine to skip loading MIP maps and to 'Load Using Default Sizes.'
I won't go over how to use the paint programs here (that's up to you to figure out), but some things to keep in mind:

A. Straight-up 'painted' textures usually look like crap. You're often better off using the hue/saturation tools to change the existing textures (there are obviously plenty of exceptions to this, so try things out and see what you like).

B. Some, though not all, textures include transparency, via what is known as an 'Alpha Channel.' I won't spend much time on it in this tutorial, but it is the cornerstone of another modding trick, known as 'col-based transparency.' I just wanted to mention it here so you're aware of it.

C. Since you'll be applying these textures to curved, irregular models, what looks like a straight line in Photoshop does not always look straight in-game. Frequently check your work in the Asset Explorer to ensure everything looks right and save yourself time and effort later.

6. Saving

Saving is a little more complex than hitting ctrl+S. After you name your file and choose its destination, a new dialog will pop up with a bunch of esoteric options:
We need our new texture to have exactly the same filesize as the original or the game will choke on it and crash. So, we'll want to 'Generate MIP maps' and make sure we select the correct DXT compression from the pulldown menu. Remember that backup I suggested at the end of Step 4? To find out which DXT compression to use, take your backup and open it with Nvidia's Windows Texture Viewer tool:
Along the bottom of the window, we can see the format, in this case, DXT5, so that's what we'll save our new texture as.

7. Injecting Your Texture Into the Col File

Now, back to the Asset Explorer. Navigate to the DDS textures and select the one you wish to replace. Right-click to bring up the contextual menu and, this time, choose 'Inject...' and browse to your new texture. If it complains about the filesize being incorrect, you have messed up something, probably in either resolution or one of the saving options, so go back and try to find your error. If not, you can click back on your model and see how it looks:
That's it. You've made your first skin. Congrats!

Once you feel comfortable with this process, you can move on to hex-editing the col file to create transparency effects or material swapping, making custom Normal Maps and directly editing the 3D mesh model.

15 comments:

  1. Thanks Hunterk .. i have been browsing the shoryuken.com and found maky of your skins .. i love them all , and thanks for sharing this information with us all , this is not something everyone tells other people for free .:)
    i would like to add you as a friend on my Facebook account . I case you are interested add me here

    nix.14.2007@gamil.com
    :)
    Thanks again

    ReplyDelete
  2. Hi Nix,
    I'm glad you like the skins and tutorials :D

    I'd be happy to friend you, but I'm not on Facebook.

    ReplyDelete
  3. it wont let me open the file with photoshop when i try and open it it says not the right kind of document

    ReplyDelete
  4. You must have skipped/borked the bit about installing the DDS plugin. Without that, Photoshop won't recognize the files.

    ReplyDelete
  5. after i download the plugins were do i put them

    and can i join ur SF4MODS workpage

    i have made mods ive only made cos mods but there preaty cool

    you can see them youtube heres my user name: STREETFIGHTERROX

    ReplyDelete
  6. Hey hunter,

    I noticed some modders actually increase the bust size of their models. Does that involve more tweaking beyond this?

    I want to tinker around this and eventually want to modify slight things like height and body width. Not too complicated (at least I think) :)

    ReplyDelete
  7. Hi Anubis,
    Usually that sort of thing is just a matter of moving some vertices around in a 3D modeling program. Sometimes a little bit of texture adjustment is required, as well.

    ReplyDelete
  8. wow!! that was really awesome, anyway, can you teach me or give me some tips on how to do it on SF4 VOLT on IOS port? hope that you can help me out.. thanks and best of luck man

    ReplyDelete
  9. Hi Fawk Yu,
    To work with iOS devices, I would assume you would need to jailbreak your device and you would need access to the files that the program loads. If that's possible, the tools we have should probably work okay, since iOS appears to be little-endian, just like regular PCs.

    If you can get into the files, I'd be happy to help you figure the rest out.

    ReplyDelete
  10. Hello hunter.

    So far This tutorial shows us how to paint onto textures that have already been mapped and pelted for us. But more and more (as I grow more ambitious in modding I guess) I am coming across situations where the mapping is making it quite difficult to work on bits I am not sure where on the model they are. Do you have a tutorial that shows how to remap textures?

    ReplyDelete
  11. Unrolling models and creating your own UV maps are possible via Blender but I don't have any tutorials for it (requires exporting as SMD, unrolling the model, moving/creating UV maps, then potentially creating your own EMB bundles if they're not the same size/resolution as the originals). If you just need to figure out what object goes where, I recommend just painting a bright color onto that part and then test in-game to see where it shows up. You can also export the model as an obj and certain versions of photoshop will allow you to load the model and the texture as a 3D object and you can paint on it directly that way.

    ReplyDelete
  12. 2 things hombre.

    1: I recently got into this whole modding SF Business, and I wanted to make some bits and pieces of it glow, but don't know how to go about it. If you can possibly help me with this it'd be great appreciated.

    2: Is it possible to bring the model and edit it in another external program i.e Maya or 3Ds Max? it'd be dope.

    Thanks a lot for the Tut man, much obliged.

    ReplyDelete
  13. @Anon
    1. That's done in the obj.emm files. Check out the "materials editing" tutorial. You'll be pulling the materials and properties from Oni (or mecha-zangief, among others). You can do it in hex or using sloth86's EMMEdit tool.

    2. Yes, you'll need sloth86's EMG2SMD conversion tool, then you can import the model into Blender using Valve's SMD plugin. You can then edit it, export as SMD and then use sloth86's SMD2EMG tool to bring it back to SF4 format. This is an involved process, though, and you'll probably find it less frustrating to master the beginner and intermediate skills before tackling it.

    I recommend going through the tutorials in order from skinning, to "col-based transparency" (this one is all hex-based and obsolete, but it's a good place to learn how the engine works), material editing (similar process to col-based transparency), model editing with Misfit (not as powerful as Blender, but still useful for repositioning objects), creating high-res textures (i.e., creating EMB bundles from scratch with Kensou's Tools), then model swapping. After that, you should have the skills to do model replacements using sloth86's SMD tools and Blender.

    ReplyDelete
  14. I know this is gonna sound weird but is it possible to swap Bodies as well? such as if i want sakuras body for ryu??

    ReplyDelete
  15. Yes, as a matter of fact, you can:
    http://filthypants.blogspot.com/2011/07/ssf4ae-pc-moveset-swap-tutorial.html

    However, I think you need to use SF4Remix's launcher for doing this in Ultra because Capcom cryptosigns/checksums the movesets now.

    ReplyDelete