الجمعة، 22 أكتوبر 2010

List of SF4 Materials and Attributes

This is just the start of the list, so hopefully I'll be able to add a lot more as time goes on. Everything will be formatted as:
Name/Source:
Material: Plain English
[Hex code]
Attribute: Plain English
[Hex code].

Akuma's eyes:
Material: Emission_W
[45 6D 69 73 73 69 6F 6E 5F 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00]
Attribute: Glare
[47 6C 61 72 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 01 00 00 00]

Highly Reflective Metal Effect:
Material: SpcEnv_W or SpcEnvAlpha_W (for use with an alpha channel)
Attribute: ReflectCoeff
[52 65 66 6C 65 63 74 43 6F 65 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CD CC CC 3E]
ReflectFresnelBias
[52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 42 69 61 73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 33 33 3F]
ReflectFresnelCoeff
[52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 43 6F 65 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F]

Medium Reflective Metal Effect:
Material: SpcEnv_W or SpcEnvAlpha_W (for use with an alpha channel)
Attribute: ReflectCoeff
[52 65 66 6C 65 63 74 43 6F 65 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3F]
ReflectFresnelBias
[52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 42 69 61 73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CD CC CC 3D]
ReflectFresnelCoeff
[52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 43 6F 65 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 40]

Minimal Reflective Metal Effect:
Material: SpcEnv_W or SpcEnvAlpha_W (for use with an alpha channel)
Attribute: ReflectCoeff
[52 65 66 6C 65 63 74 43 6F 65 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CD CC 4C 3D]
ReflectFresnelBias
[52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 42 69 61 73 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A D7 23 3C]
ReflectFresnelCoeff
[52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 43 6F 65 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CD CC CC 3D]

Works on any non-metal material:

Full Transparency (compatible with DXT5 or DXT1 w/ 1-bit alpha DDS)
Attribute: AlphaTest
[41 6C 70 68 61 74 65 73 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 96 00 00 00]

Semi Transparency (only compatible with DXT5 DDS)
Attribute: AlphaBlend
[41 6C 70 68 61 62 6C 65 6E 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 01 00 00 00]

Attribute: AnimationChannel
[41 6E 69 6D 61 74 69 6F 6E 43 68 61 6E 6E 65 6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 03 00 01 00]

Attribute: ZWriteMask
[5A 57 72 69 74 65 4D 61 73 6B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 01 00 00 00]

Attribute: GlareCol(RGB)
[47 6C 61 72 65 43 6F 6C 52 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EC 51 78 3F 47 6C 61 72 65 43 6F 6C 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EC 51 78 3F 47 6C 61 72 65 43 6F 6C 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EC 51 78 3F 47 6C 61 72 65 43 6F 6C 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3F]

Attribute: LowRes
[4C 6F 77 52 65 7A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 01 00 00 00]

New Arcade Edition-only Materials (vfx-related)

HAKAN's Oiled body: SpcBumpBrushOilSSS_Shadow_UV1_W
HAKAN's Oiled clothes: SpcBumpBrushOilSSS_UV1_W
HAKAN's Oil: T1_C_Scroll_Emission_W

MAKOTO's body turning red: SpcBumpBrushSSS_Col_S_UV1_W
MAKOTO's face turning red: SpcBumpBrushSSS2_Col_UV1_W

EVIL RYU's body emission: SpcBumpBrushEmiMask0_UV1_W

ONI's body emission: SpcBumpBrushEmi_UV1_W
ONI's Right Arm emission: SpcBumpBrushEmi0_UV1_W
ONI's Left Arm emission: SpcBumpBrushEmi1_UV1_W
ONI's Right Leg emission: SpcBumpBrushEmi2_UV1_W
ONI's Left Leg emission: SpcBumpBrushEmi3_UV1_W
ONI's hair emission: SpcBumpBrushEmiAlphaConst_UV1_W
ONI's UC2: SpcBumpBrushEmiMaskConst_UV1_W

الخميس، 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

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).

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.

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.

الأربعاء، 20 أكتوبر 2010

How to Extract SSF4 Data From an Xbox 360 ISO

For people who want to get into using files from Super Street Fighter 4 on Xbox 360 with their PC version of vanilla Street Fighter 4, you have to go through a number of steps that have never been appropriately documented, so here goes:

1. Collecting the right tools for the job

First off, you need a copy of SSF4 in ISO format. I don't want to know how you get it, but I recommend purchasing it and then ripping it to your PC using the 'hot swap' method.

Next, we need a copy of isoextract, which extacts the data from the 360 disc image. You can download it here or here.

We also need QuickBMS, a script-based file extractor written by Luigi Auriemma, as well as a script to use with it. You can get QuickBMS here and the extraction script here or here.

2. Extracting the ISO

Open up isoextract and you should see this screen:
Using the buttons on the upper-right, click on 'choose ISO-folder' and navigate to the directory where your SSF4 ISO is stored. Next, click on 'choose destination' and select a directory where you want your extracted files to reside.

Then, just click the big button marked 'go' down in the bottom right.

Now, once it's all finished, if you navigate to your extraction directory, you'll find it has created a directory structure from the disc. Go to archive > battle and you should see a file named 'battle.eaf.' This guy has all of the goodies, so we gotta get them out using QuickBMS.

3. Extracting the files

Open QuickBMS and it should pop up a console window like this:
It should also automatically pop up an explorer window, which you can use to navigate to the QuickBMS script we got back in Step 1.

Next, it will pop up another explorer window, which we will use to navigate to our battle.eaf file.

Then, it will pop up a final explorer window, which we will use to select our output directory. I just chose that same 'battle' directory.

Now, back in the console window, you should see a whole bunch of output stream by, listing the files that are being extracted.

That's it. You're done. You should have a complete file structure available now, with access to all of the proper files, including character and stage data. Most of this can be opened with the latest version of piecemontee's Asset Explorer, using the new support for big-endian files.

الأربعاء، 6 أكتوبر 2010

SF4 Beginners Guide to Material Attribute Swapping

Credit for this tutorial goes to alekqz, I just cleaned it up a bit.

This tutorial will show you how to give a body part a reflective, metallic look, but a similar process can be used to grab other materials, such as Akuma's glowing eyes.

1. First, open a *.cos.emz file using piecemontee's Asset Explorer and look for the body part you wish to modify, in this case, Zangief's upper body:
Take note of the name used to reference the body part, in this case, 'body.'

2. Next, open a decompressed *.col.emz file in a hex editor (I use the free Frhed, but any hex editor will work) and search for that body part name:
Below the name, you will find the material type attribute, usually something like SpcBumpBrush with some more letters and stuff after it, like this:
3. Now, we want to overwrite that material type with 'SpcEnv_W.' In hex, we want to paste in (53 70 63 45 6E 76 5F 57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00).

As with all hex-editing in SF4, it's very important that you overwrite because the resulting files must be *exactly* the same size as the original or the game will crash. It should look like this when we're finished:
4. Next, we need to scroll down to the bottom of that section, just before the next section starts, and look for BrushA, BrushB and BrushC, like this:
We want to replaces those Brush entries with ReflectCoeff (52 65 66 6C 65 63 74 43 6F 65 66 66), ReflectFresnelBias (52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 42 69 61 73) and ReflectFresnelCoeff (3C 52 65 66 6C 65 63 74 46 72 65 73 6E 65 6C 43 6F 65 66 66), respectively (forgive the typo in the pictures; it's Fresnel, not Fesnel):
5. Finally, in the case of metal effects, we have to choose how reflective we want to make the material (also known as 'specularity'). This is controlled by modifying the spaces after the Reflect* entries. For a chrome-type effect, change the last 2 numbers in each section to @ symbols (40 40), like this:
For an enamel-type effect, the last 2 numbers after ReflectCoeff and ReflectFresnelCoeff need to be a Euro symbol and a question mark, like this (the last 2 after ReflectFresnelBias should be blank--or 00 00 in hex):
For a polished effect, the last 4 numbers of the sections need to be changed to the hex code of (CD CC CC 3D), (CD CC CC 3D) and (66 66 66 3F), respectively, like this:
Save your file and you're done!

These are the only 3 metal effects known so far, but there may be more, so be adventurous! Experiment!

Update 10/18/2010: sensibeat tracked down 3 more metal effects:
metal_gold (less reflective):
ReflectCoeff ÍÌL= (CD CC 4C 3D)
ReflectFresnelBias .×#< (0A D7 23 3C)
ReflectFresnelCoeff ÍÌÌ= (CD CC CC 3D)

metal_silver (more reflective):
ReflectCoeff €? (80 3F)
ReflectFresnelBias ÍÌÌ= (CD CC CC 3D)
ReflectFresnelCoeff €@ (80 40)

crystal (highly reflective, mirror-like):
ReflectCoeff ÍÌÌ> (CD CC CC 3E)
ReflectFresnelBias 333? (33 33 33 3F)
ReflectFresnelCoeff ? (3F)

One word of caution: you'll want to modify the DDS textures to look like whatever material you're trying to mimic but don't make it too dark, as the reflection can make it hard to see.