Thursday, August 25, 2011

Intermediate Guide to SF4 EMG (Model) Swapping

Sloth86 has cracked model manipulation in SF4 wide open. It's now possible to swap models from character to character and costume to costume in a fairly consistent manner, thanks to sloth86's research. Additionally, he was nice enough to write simple, straightforward graphical tools that extend this ability to almost anyone. Just to be clear, though: this procedure often produces strange results, especially with respect to animations. Sometimes these results can be fixed through model editing, sometimes not.

In this tutorial, we're going to use sloth86's methods to take an EMG model from one character and replace it with an EMG model from another character.

First things first, lets get all of the tools we'll need. This is a pretty advanced procedure, so we're going to need piecemontee's SF4Viewer (aka, Asset Explorer), Kensou's Tool(s) and Sloth's tools, specifically, EMGSwap and DDSREFEDIT. Once you have those tools downloaded and organized, we're ready to get started.

First, identify which model you want to move and where you want to put it. I'm planning to take Guy's head (donor model) and place it on Ryu's body (recipient model).

Once you've got it all planned out, open both models (for me, GUY_01.obj.emo and RYU_01.obj.emo) in the Asset Explorer and find the desired objects--in my case Guy's 8th EMG (counting each model, starting from the top in the Asset Explorer's display)--and I'm going to replace Ryu's 12th EMG. The recipient's numbers are important, so write it/them down.
Now, select the donor object, right-click and choose 'Raw dump,' name it something informative (I chose face.emg) and click 'save.'
Next, armed with our model files and numbers, place both the donor *.emg file and recipient *.obj.emo file into the same directory as EMGSwap and double-click on EMGSwap to run it.

This window should pop up:
In the field labeled "Input EMO file," type the name of the recipient model, in my case RYU_01.obj.emo. Then, in the field labeled "EMG # to swap out," type the number of the recipient model you wish to replace, in my case 12 (for Ryu's 12th EMG model, the face). Next, in the field labeled "EMG file to swap in," type in the name of our raw-dumped donor model, in my case face.emg. Finally, in the field labeled "Output EMO file," we'll just leave the default 'new.emo' for now (we'll rename it to replace the old model later, but in the meantime, we don't want to mess anything up before we're sure it's cool).
Click 'Go' and cross your fingers. If all goes well, you should see a window like this pop up:
Looks good so far.

Now, lets check out our Frankenstein's monster by opening the 'new.emo' file in the Asset Explorer:
Yeesh, looks pretty freaky. Since Guy's head was sized and positioned significantly differently from Ryu's, we're going to have to change some things up to make it look normal again.

So, still in the Asset Explorer, lets select our newly imported model, right-click and choose 'Extract...' from the menu. Name it something informative--like face.obj--and click 'save.'
At this point, you might be asking yourself, "if I'm extracting and converting into an obj anyway, why didn't I just export from Guy's model and import straight into Ryu's model in the Asset Explorer, skipping all this EMGSwap bullshit?" Well, smarty-pants, most files in AE (including the *.obj.emo files we're messing with right now) include an index that includes the location and size of each and every file contained within. The Asset Explorer uses this index to determine what can and can't be extracted/injected safely.

However, sloth86's EMGSwap tool rewrites this index for us, so the Asset Explorer can safely extract/inject our borrowed models once EMGSwap has done its thing. Perhaps someday that same functionality will be integrated directly into the Asset Explorer (it's open source, after all), but that day is not today.

Anyway, so we've gotten our model swapped in, but it looks like crap and we'll need to use model editing to fix it. I'm not going to spend a lot of time on this part, since you should already know about model editing enough to fix things yourself. For me, Guy's head was the wrong size, so I needed to enlarge it and move it around a bit. I really should edit Ryu's neck to meet the head, too, but you get the idea...
Alright, with my edits in place, the model looks okay, but you'll notice that the skin looks all white and pasty. That's because it's looking to Ryu's first DDS texture, which corresponds to--you guessed it--his duffel bag. This is actually convenient for my purposes, since I can just replace the duffel texture with my donor texture. Thus, I won't need to edit a bunch of DDS references using sloth86's DDSREFEDIT tool, but you probably will (hence, why I included it in the tools you'd need to download).

I'm only going to use it a little, but I'll try to tell you more about it when the time comes.

In the meantime, we need to create some new texture and normal map containers to go with our new model. To do it, we'll use Kensou's sf4tool, just like in this earlier tutorial I made.

Open your donor's *.col.emb and *.nml.emb files in the Asset Explorer, find the textures that correspond to your donated model, right-click and choose to 'Extract...' them. Name them something informative (I used 'Guy.dds' and 'Guynmap.dds') and click 'save.'

Next, open your recipient's *.col.emb and *.nml.emb files in the Asset Explorer an extract *ALL* of his or her DDS textures. Be sure to name them something informative so you can remember which order they're stored (1.dds, 2.dds, etc. and 1nmap.dds, 2nmap.dds, etc. work well).

Now, as per the aforementioned tutorial, create new *.col.emb and *.nml.emb files with your donated textures in the first position. (I actually replaced my recipient's first textures, so the order for mine was Guy.dds, 2.dds, etc. and Guynmap.dds, 2nmap.dds, etc.) EDIT: I used the first position, but apparently the *last* position is more likely to work...?
At this point, you would run the DDSREFEDIT tool and input the number '0' into the 'new texture map' field and '1' into the 'new normal map' fields (assuming your recipient only had a single texture to begin with; this isn't the case with shoto original costumes, though, so count the textures if you need to, according to the instructions in the program; I had to use '5' for the normal map number), your modified *.obj.emo file in the 'Input EMO file' field, and the number of your recipient's replaced model in the EMG # field (in my case, it was '12'). You would then check the box for '+1 to every other normal map references' (this last bit was unnecessary for me because I replaced the duffel bag normal map with the donated normal map).

This was my result:
Anyway, if this last part seems confusing, don't worry about it. I'll be making another tutorial that goes over the texture reassignment tool using a more typical example in the future. In the meantime, try your best, share your work and ALWAYS MAKE BACKUPS.

Friday, August 12, 2011

Test Driving Oneiric Ocelot on ThinkPad X120e

It's that time again. With another Ubuntu release looming on the horizon, I decided to upgrade my netbook to the latest daily build (8/12/11) of Ubuntu 11.10 Oneiric Ocelot, which is still in alpha stage.

Installation

Installation was unchanged from 11.04, so much so, in fact, that it even says "Welcome to Natty Narwhal" :P

As with Natty, installation was quick and easy, with the option to download updates in the background as you go. As before, personalization questions were presented *after* installation had already begun, which saves even more time.

First Impressions

The login screen has changed a bit, and now looks really snazzy, with a stylish dot motif in the background. There's an option to select a Guest Account, along with the option to use the new 2D/non-accelerated Unity desktop, which I believe is powered by the Enlightenment libraries. This 2D desktop supports true transparency, which is nice.

Drivers

The jockey-powered "Additional Drivers" utility automatically found the binary driver for my wireless, which is the nonstandard Broadcom chipset option, so all I had to do is tell it to activate it. CORRECTION: My wireless driver was enabled, but not working. On returning to jockey, the driver was listed as not installed and if I tried to enable it, it would give me the error:
SystemError: E:Unable to correct problems, you have held broken packages.
This suggests that my packages were installed, but somehow got messed up. To fix it, I had to find out which packages for my chipset were installed, by typing:
dpkg -l | grep roadcom
(notice, I searched for 'roadcom,' which will catch packages with both 'broadcom' and 'Broadcom' in the title and/or description. This is important, as the bcmwl-kernel-source package will not show up if you search for 'broadcom' alone.) Then remove them entirely by typing
sudo apt-get purge [package names from the previous command]
Reboot, then try the 'Additional Drivers' utility again. It should successfully enable the driver, then you can reboot again and everything should be working properly.

If you got the standard chipset, it should use the open source driver by default. The default video driver is the Gallium-3D-driven open source driver, but I chose to install the proprietary fglrx driver from AMD via the driver utility.

Audio seems fine and my HDMI audio hardware and output were both recognized from the start. The headphone jack also properly mutes the internal speakers when headphones are plugged in, which is an improvement over my experience with Natty.

Waking from suspend seems fine, too, though hibernation still seems to be a no-go. :(

Applications

The default email client is now Thunderbird, which works well with Firefox, the default browser, and the default music client is now banshee (this may not have been a new change; I can't really remember...).

The built-in search tool for Unity is much improved, with little icons down at the bottom of the window for choosing whether to search everything, just files and folders, just applications, or just search your music collection.

Everything seems to be fine so far, a solid improvement over Natty on these machines. I'll post back if I run into any problems. If you have any questions or experience any problems, post a comment!