Wednesday, September 25, 2013

The Kuwashii Challenge: .MOD script manipulation

The Kuwashii visor has been a sore sight to many since it's introduction in Mass Effect 2 due to the position of it's rotating reticule in relation to the eye. There have been several modders in the past that have released reticule position fixes for the visor for both ME2 and ME3, which was unfortunately only possible at the expense of it's dynamic reticule. This is because we as modders cannot influence the position of the animated texture overlay and are left with no option but to "clear" it and to paint a static reticule on the main visor texture instead.

I wanted to release my own visor/reticule fix combined with a re-textured framework to fit with my armor-sets, unfortunately I ran into an additional problem as it seems the dynamic reticule is shared with Garrus' visor which causes the reticule fix to indiscriminately break the dynamic reticule for both Shep and Garrus alike. Texmod and ME3Explorer use the hex identifiers for images to automatically match it's replacement across the board. For Texmod this is something that can't be manipulated and as such the situation for Garrus can only be resolved by sorting a static reticule directly onto his visor texture.

We do have some options using ME3Explorer while creating a texture replacement .MOD as we can manipulate the automatically generated mod script to skip certain PCC file references and only apply our modded textures to a selection of our choosing. Because this is (not yet) an automated process this has to be done by hand by going into an automatically generated script and adjusting the PCC references and IDs belonging to the texture instances.

You would assume that if Garrus and Shepard are both affected by a .MOD, the fix would be as simple as adjusting the replacement script for the reticule to only apply to PCC files associated with Shepard. 
To do that you'll first have to create a .MOD, what I did here was feed the TPF straight into Texplorer's mod generator and let it create a .MOD.
When you do this Texplorer will automatically match all instances of a texture and create a list of PCC files and IDs to replace in the script for every texture.

You'll notice that when I selected the dynamic reticule (TUR_HED_PROGarrus_Holo_Diff) in the list in ModGenerator that the info tab shows all PCC files and associates IDs it will add to the script.
I can't change that list from here but I can load in a generated .MOD through ModMaker and preview the script for the texture replacement jobs from there to edit them.
 As you can see, the script lists 8 PCC files total and the highlighted 2 are clearly associated with Shepard. I removed the 1st and 4th through 8th line here, only keeping the 2nd and 3rd.
Scrolling down a little I did the same on the ID's. Similarly there are 8 ID's listed, so I'm keeping the 2nd and 3rd and removing all others. The script repeats this list a bit further down, so I applied the same changes to that section. After editing the lists looked like this:

After having edited the script, I hit save changes on the preview windows and re-saved the .MOD so it would include the changes I made to the script.

In a perfect world the issue would now be resolved, unfortunately it showed through ingame testing that out of the 6 PCC files associated with Garrus, 4 use a material reference that ties in with Shepard. This meant that in practice, the script manipulation only worked for Garrus on the Normandy and the dynamic reticule was preserved there, but it stayed broken in Explore mode. As such I figured I would add a texture replacement job for a version of his visor including a static reticule like in the texmod version, but only for the instances in which his dynamic reticule was broken.

The method for this change is exactly the same as the one detailed above, with the exception of me keeping different PCC files in the list this time around. The edited script for Garrus' visor (Visor_Frame) ended up looking like this.
 Et voila!

Script manipulation is not the only tool available to us when trying to achieve a certain effect.
You can adjust meshes through a 3D editor, adjust the UV map (texture wrap), manipulate the texture through a photo/image editor like Photoshop or change the material assignment through Meshplorer. Which method serves your specific problem best often comes down to trial and error. In this case, after having tried all other options available to me, I settled on script manipulation as the best solution. I hope this will prove helpful to some.

The completed Texmod TPF and ME3Explorer .MOD for the Kuwashii Visor are featured in my BSN Thread.

Sunday, September 1, 2013

Guide: ME3Explorer first time setup information

What is ME3Explorer?

ME3 Explorer is a fan-built toolset used to mod the Mass Effect Trilogy. Several features are still under development and new features are still actively being introduced. With it you can decompress, load, edit and save PCC files. You can mesh and texture mod and create content mods for ME3 within the constraints of the tools and the limitations of the game itself. The toolset is useable for mod creators and for those that simply want to apply already created mods.

Why this guide?

This guide is specifically meant for people looking to start using ME3Explorer as a means of permanently replacing textures and meshes in Mass Effect 3. I might add information specific to the tools for ME1 and ME2 as well at some point but this guide is not specifically tailored towards modding the older games.

First things first

Backup your vanilla install files in the Mass Effect 3 folder. The tool does not affect game saves or other Mass Effect 3 files except the ones listed below:
  1. Make a backup of "PCConsoleTOC.bin" and "PCConsoleTOC.txt" in "..\Origin Games\Mass Effect 3\BioGame". You can rar/zip them up together and mark them as your vanilla backup.
  2. Make a backup of your entire "CookedPCConsole" folder (all PCC and TFC files) in "..\Origin Games\Mass Effect 3\BIOGame\CookedPCConsole". Mark it as your vanilla backup. 

Which version should I install?

You can choose to download and install ME3Explorer one of two ways.
  1. You can use the latest SVN release. It is used by the coders behind the project. Releases are referenced by their revision (REV) number. SVN is a Revision Control System: a repository of files, often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made it, references to problems fixed or enhancements introduced by the change. You can decide to use this version to be completely up to date and to help test bugs in the newest revisions of the program.
  2. You can use the latest stable release from Sourceforge, which is often shorthanded to the "SF release". The SF is the latest SVN REV the creators deemed stable enough to transfer over. It will offer a choice between a Source and Binary release, you'll want to grab the latter. This version is specifically meant for those looking for the most stable solution that are not interested in bug-testing and helping development. It is always going to be slightly outdated. While most stable, this version is not necessarily bug-free.
As of this writing (updated Juli 29th, 2014) the most recent SF release is Version 0109k (Jul 7th, 2014). This the counterpart of SVN REV 653. The most recent SVN REV is currently 657.
Seeing this information is transient, it is always advised to check the bug report section on the ME3Explorer boards to make sure there are no mayor bugs with recent releases reported. It is also always good to simply ask if you are unsure how to proceed.

I normally always advise using the SVN as you will not be able to receive any support using older versions of ME3Explorer due to it being in constant development.At the moment however, my advice is to use the latest SF or SVN rev 653.

 ME3Explorer on Sourceforge           Tutorial on using SVN                    
ME3Explorer Bug report section       ME3Explorer version release News

Installation and first time setup

When downloading the SF you can place the Binary folder anywhere you find convenient (the SVN download is explained in the tutorial I linked above).
Now you'll want to navigate to the following locations to start up "ME3Explorer.exe": "..\Binary\" (SF) or "..\ME3Explorer\bin\Debug\" (SVN). 

ME3Explorer doesn't conventionally install so when you doubleclick the exe, the program will simply open. It is not yet ready for use though, as it needs to go through a one time setup procedure that will allow it to create and scan some necessary files in your game's install folder.
To start that process we'll have to start up Texplorer which is located under "Developer Tools".
You'll get a popup asking you if you want to edit DLC content as well.

This prompt allows you to pick whether you would like to mod the basegame only or the DLC content as well. While you might think there's no harm to include the DLC, there are several considerations before deciding which way to go with this so please carefully read the following section.

Why do we get this option at all?

Due to Origin's frantic DLC checking, it is impossible to mod DLC content without it throwing authentication errors once it's checked. As such, when you mod DLC content, you are forced to use a  'fix' that spoofs the DLC check communication for you and validates your DLC.
Download the DLC fix here: ME3 DLC Patcher. Simply copy the two provided files into "..\Origin Games\Mass Effect 3\Binaries\Win32\" and say yes when prompted to overwrite.

Scan without DLC

Texplorer will create a tree-structure file (me3tree.bin) of about 6mb in "..\ME3Explorer\bin\Debug\exec\" (SVN) or "..\Binary\exec\" (SF) that it can (re)use to visualize the game's file-structure and to enable you to browse through and manually replace texture files. Upon running your first mod Texplorer will additionally create a file called “CustTextures0.tfc" in "..\Origin Games\Mass Effect 3\BIOGame\CookedPCConsole" and it will create an entry for that file in your "PCConsoleTOC.bin" that tracks it’s size. The scan will take about 15 minutes to finish depending on your setup. 

Scan with DLC

Texplorer will create a treestructure file (me3tree.bin) of around 20mb in "..\ME3Explorer\bin\Debug\exec\" (SVN) or "..\Binary\exec\" (SF) that it can (re)use to visualize the game's file-structure and to enable you to browse through and manually replace texture files. It will scan the basegame and will unpack parts of the DLC SFAR contents in theie respective DLC folders. These files are necessary for DLC modding so you can't delete them once Texplorer is done generating the treestructure file. Upon running your first mod Texplorer will additionally create a file called “CustTextures0.tfc" in "..\Origin Games\Mass Effect 3\BIOGame\CookedPCConsole" and it will create an entry for that file in your "PCConsoleTOC.bin" that tracks it’s size. The scan can easily take up to 2 hours to finish depending on your setup. 

Note: Seeing DLC is unpacked during a scan it's a good idea to back up your unmodded DLC folder, though optional as you should create a backup of the unpacked state as well after treescan has completed.

After the scan

Texplorer generated your treestructure file called "ME3Tree.bin" in "..\ME3Explorer\bin\Debug\exec\" (SVN) or "..\Binary\exec\" (SF). To avoid unnecessary rescanning when something goes wrong for whatever reason, make a backup of your treestruct. You can mark it basegame or DLC, whichever is appropriate, and be sure to add the revision number it was created with as well.
You can do this by hand, or use Texplorer's tree export functionality introduced in SVN REV 628.

If you opted to scan with DLC, make a backup of your entire DLC folder so you preserve the vanilla post-scan state of the folders to again avoid unnecessary rescanning.
When scanning with REV 623+,  make a backup of your entire DLC folder after treescan is completed as it's in unpacked state after so to vanilla compatible with your new tree you'll need a backup.

Formats Explained 

.PCC - The PCC format is what Mass Effect uses to package the game's content. As PCC files are the entire package, they can overwrite any changes made to the same file before replacement, AKA PCC mods should always be applied first as .MODs and TPFs can do specific replacements inside these modded PCC files keeping previous changes intact as long as they don't overwrite the same object inside them.

.SFAR - The SFAR format is what Mass Effect uses to package the game's DLC content. Every individual DLC has it's own default.sfar located in uniquely named folders at "..\Origin Games\Mass Effect 3\BIOGame\DLC\".

.MOD - These are packages created by ME3Explorer that can hold binary, object and PCC replacement jobs. Because scripts used for the replacement jobs are included in the .MODs these are revision sensitive while the toolset is still under development, pay attention to which revision a .MOD was created with.

.TPF - Texmod is a utility to browse, extract, save and modify textures in Direct3D 9 applications. In order to share and distribute texture modifications, TPFs (Texmod Package Files) can be created which are compressed to prevent further modification. This modding method allows you to temporarily replace any texture in your application without the need to use an application specific modding tool or replacing any files in your application's installation. Using ME3Explorer, you can convert Texmod TPF's to the ME3Explorer .MODs format or you can load them in directly using the 'TPF/DDS Tools 2.0' and apply them to your game permanently.

.mod Compatibility

Be aware that DLC mesh .mods and basegame/DLC texture .mods created between REV592 and REV622 will no longer inherently work on REV623. This means the current SVN (628) is not compatible with the latest SF (600). TPFs still work as before through TPF/DDS Tools. In simple therms: Make absolutely sure .mods you are downloading are documented to be compatible with your version of ME3Explorer, be it SVN or SF release. Older mods can cause errors and/or simply won't apply correctly or at all.

You can use .mod fix capability in ModMaker post REV 628 to automatically fix the script for that .mod to work with the newer REVs. While this might work, we can't guarantee it will and best practice is always to seek out mods that are inherently compatible with the revision you are using.
We do recognize this isn't always possible.

To avoid issues with texture .mods caused by REV changes, you can opt to download .tpf files instead. The TPF/DDS Tools included in the toolset allow you to either directly apply a .tpf to the gamefiles as you would a .mod, or you can turn your .tpf into a .mod for your current revision.

Selecting mods

Any .MOD that was created with a DLC struct can be used to apply to basegame content, but whether it'll replace DLC content depends on your personal setup in regards to the treestruct you are using. Any .MOD that was created with a basegame struct is completely incapable of replacing DLC content, whether or not you are using a DLC struct yourself.

Sources for pcc / mod / tpf downloads:
Antarius' New Compilation of HR Tex (.MOD & fixed.tpf)   Varied texture mods
HR Textures by Ottemis   Varied texture & mesh mods
OTTE MODS    Hair mesh mods
ELE MODS    Varied texture & mesh mods
ELE's Tumblr    Hair mesh mods
Kani Hime's All Thumbs Production (PCC)   Varied texture & mesh mods
Voodooseason's Tumblr (PCC & .MOD)   Varied texture & mesh mods
Rana's Tumblr (PCC)   Hair mesh mods
wildeatheart27's Tumblr (PCC)   Hair mesh mods
nameislooney's Tumblr (PCC & UPK)   Hair mesh mods

Applying .mods

Applying .MODs is done using ModMaker, it's located under "Tools".
I personally always load through "Jobs", "Add Jobs to list" but you can also go through "File", "Load Jobs". To start applying your loaded mods, go to "Run", "Run all".
While applying mods ME3Explorer can run both hot in memory (but up to a shared cap of 4gigs) and hot on the CPU (up to 100% load on all cores), as such it can go unresponsive at times and lock up your system. You should be able to see it cycle through saving PCC files and applying the mod jobs in the debug window. Heavy mods are not just recognizable by the number of texture replacement jobs, they are also those in which a texture replacement job has a lot of instances in the game's PCC files and ends up having to use multiple threads to save each PCC file with. These are the mods that will spike your CPU usage and overburdening your system while these run is ill-advised. Should your program crash during mod installation, don't worry! Try re-applying the mods in question by loading in less at a time or go one by one and you should be able to reapply the mods without issues. You can also go through "Run", "Run Some" to check loaded jobs on and off. That way you can manually split an already created job list.

Applying .TPFs

In order to apply your Texmod TPF permanently to the game, the developers of ME3Explorer have created a nifty little thing called the "TPF/DDS Tools". It will allow you to load in any .tpf, check it's file formats for validity and if valid, apply it directly to the game as you would a .mod. You can also create your own fresh .mod for the textures with this tool.

This means that downloading a fixed format TPF will ensure you never have to pay attention to the Revision a texture-mod was built with in relation to the version you are using.

Launch ME3Explorer, go to "Tools" and pick "TPF/DDS Tools" in the dropdown menu.
In the window that pops up, click "Load TPF" and browse to the TPF you want to install.
Once you've opened it you'll see that the textures are listed now as is the texmod definition file (def). The definition file will help tell the game where these textures belong.

Every texture has it's own unique hex id or hash number (0xDB481023 for example), the game uses these to match them to the right textures in the game files. Texmod definition files provide the link between the filenames and the corresponding hex id's automatically when the tool can't find these id's in the filename itself. Now down at the bottom it'll tell you the Hashes were generated, click the "Analyse with Texplorer" button to let it scan if the formats are fitting for permanent replacement.
Once it's done it'll say "Finished Matching!". You can now hit "Install valid" to permanently install all valid textures to your game.

Now sometimes you might run into TPF's that are not in the right format and/or cannot be matched to their ingame counterparts. For these and other such issues I suggest you check out the more expansive tutorial on the TPF Tools by KFreon[/url] and the guide on fixing format issues with TPF's by KFreon.

Applying PCC mods

Some modders prefer to release mods by making a modded PCC file available for download rather than creating a .MOD file for mesh releases. ELE08 has written a nice guide on how to install PCC mods.
Be aware that PCC mods overwrite all other edits made to the PCC in question via regular mod application so always replace these first before you mod any other method. The same goes for content mod installers but they have their own install guides so I advise you seek them out and read them if you plan to use them.

Creating .MOD files from TPF

Texplorer was recently expanded with the ability to automatically generate a .MOD from it's base Texmod TPF as long as the file formats are correct.
This is usefull for all the TPF's that haven't been converted to .MODs yet, the recreation of old .MODs from their original TPF's and for people that experience issues with premade .MODs due to language version incompatibilities.
Unfortunately there are not a lot of active texture modders left and most released TPF's will have format issues for compatibility with ME3Explorer. Users like Antarius have made great contributions by creating fixed format TPF files with .MOD repacks by inactive modders to ensure people can easily use and repack their .MODs in the future. Here's a guide by KFreon on how to work with the TPF Tools.


When applying a .mod I am getting the following error:

Your version of ME3Explorer is newer than the .mod you are trying to apply and it is no longer compatible. Contact the .mod creator.

When applying a .mod, changes do not show up ingame, why is this?
If you are using REV623 or above, DLC mesh .mods created prior to that REV will no longer apply even though they don't throw a visible error. If this is your problem the debug window will show the following warning when cycling through the jobs it wants to apply:
"Error : Index was outside the bounds of the array."
If you encounter this, please alert the mod creator. Report any other issues to the bug report forums.

I'm getting a DLC authentication error after modding my game, how do I fix this?
As earlier mentioned in the guide, you will need to download a 'patch' that will enable you to mod DLC files while avoiding the authentication issue. Go here and download the files, copy the two provided files into "..\Origin Games\Mass Effect 3\Binaries\Win32\" and click yes when prompted to overwrite.

I'm getting a DLC corruption message after modding my game, how do I fix this?
When you apply mods to the gamefiles and they apply to DLC, they add to the overall size of the SFAR for the DLC in question. When these SFAR grow beyond 2gigs in size individually, they will start throwing corruption errors because the game can't process them properly anymore. To counter this you have two options.
1. Easy method, check which DLC have grown above 2gigs and vanilla them by copying your backup back.
2. Hard method, use the process described here: post8640.html#p8640

I vanilla'd my gamefiles through Origin update or repair but Texplorer still claims I have files modified after Juli 2013 and my treescan fails? 
Unless you throw out all modified files and redownload them from scratch or copy a backup back over that you know with 100% certainty was created right after a fresh install, just using update or repair via Origin will not work. If that is what you have done, you won't be able to see which files were originally modified because it seemingly resets the creation date back to where it should be. Still they are not kosher and you run risk of treescan falling over them. 
You can check the debug output for Texplorer to tell you which files treescan is complaining about and vanilla them properly to try again.

How do I vanilla my game and update my ME3Explorer installation so I can start fresh?
Vanilla basegame: Start by manually throwing away your "PCConsoleTOC.bin" and "PCConsoleTOC.txt" in "..\Origin Games\Mass Effect 3\BIOGame\", and any basegame file in your CookedPC folder that has a date newer than 4/25/2012. Alternately copy in a vanilla backup by hand, more viable for people with slower internet.
Vanilla DLC: Copy in the DLC backup you created AFTER you did your DLC treescan. If you never did a DLC treescan you don't need to do anything.

"Check for Update" by rightclicking ME3 in your Library in Origin, it will reodwnload any missing files. Now, throw out your entire ME3Explorer folder, you should already have a backup of you ME3Tree.bin! Download the latest SVN of ME3Explorer and put your old "ME3Tree.bin" back in the exec folder. When you launch Texplorer, it should tell you it found an existing tree and it won't trigger a rescan.

How do I vanilla my game to basegame and get rid of ME3Explorer completely?
If you have no interest in using ME3Explorer anymore and you want to vanilla, start by manually throwing away your "PCConsoleTOC.bin" and "PCConsoleTOC.txt" in "..\Origin Games\Mass Effect 3\BIOGame\" Now go into "..\Origin Games\Mass Effect 3\BIOGame\CookedPCConsole", sort by modified date and throw out any files that don't have a modified date of 4/25/2012. Be sure to include "CustTextures0.tfc". Now you'll want to "Check for Update" by rightclicking ME3 in your Library in Origin.

Alternately you can vanilla your PCC files by copying in a backup first, if your game is extensively modded and your internet connection speed is not amazing, this might be the better option for you as it won't have to redownload as many files. If you modded your DLC, you'll want to copy those over as well or manually undo changes by restoring the backups created by Texplorer. Method is described further down the troubleshoot section.
How do I avoid a rescan of the ME3Tree.bin in between updates?
You can at any given time update or completely refresh your version of ME3Explorer. To ensure that you don't have to unnessecarily rescan your Treestruct anytime you do, you'll want to hold on to a copy of your modified "PCConsoleTOC.bin" and the "me3tree.bin" and if you scanned DLC as well, a copy of your DLC folder. Remember that you cannot rescan the tree on a modded game, so this can save a lot of time.

I have copies of both treestructs, but switching doesn't seem to change anything.
This only applies since the REV 490 fix: Be sure to run Texplorer once between switching your treestruct and trying to apply .MODs to make sure the program is aware of the change.
I am trying to run a .MOD or manually replacing textures, why do I keep getting the following error?

When you first set up ME3Explorer and run your first mod, it will create "Custtextures0.tfc" and create an entry for that file in your "PCConsoleTOC.bin". Some mods seem to fail at generating this entry at times. If you followed this guide to the letter you will have a backed up copy of your modded TOC.bin which you can place back over the vanilla version to restore functionality.

How do I undo changes to basegame files made by a .MOD I just ran? 
You can most easily spot which PCC files were altered by going into your CookedPCConsole folder and sorting list by modified date. Any unaltered basegame files will have a modified date of 4-25-2012. Replace the PCC files with the appropriate modified date with the vanilla backup you have for them. Alternately, throw the modified files out manually and redownload through Origin.

How do I undo changes to DLC files made by a .MOD I just ran?
You can use the debug window to check which DLC files were edited while applying the .MOD:

In this example, DLC_HEN_PR was edited and as you can see, the program notes that an automatic backup was created while editing it. To revert changes all you have to do is go to "..\Origin Games\Mass Effect 3\BIOGame\DLC" and open DLC_HEN_PR, delete "Default.sfar" and rename "Default.bak" back to "Default.sfar". You can also copy your backup over the edited DLC folder.

ANY additional errors or problems should go directly to the official bugreport forums, NOT here.
This post is merely meant to catch most common issues to alleviate the pressure on the mods and admins on the ME3Explorer forums and to weed out known issues and newly discovered bugs that are yet to be resolved.

ME3Explorer bug report Forums

Now go forth and mod to your hearts content.

Thursday, August 29, 2013

MOD: Braided hairstyle for ME3

Note that this mod is PC only! You can't replace Meshes on the consoles. 

This .MOD will include the permanent replacement of the Mohawk Mesh only. You will have to run texmod to apply the textures. TPF is also included in the download.

To use this hairstyle on Shepard, do not forget to edit the following values with Gibbed:

Hair_diff: BIOG_HMF_HIR_PRO.Hair_Short02.HMF_HIR_PROShort_Diff
Hair_mask: BIOG_HMF_HIR_PRO.Hair_Short02.HMF_HIR_PROShort_Diff

If you have never used Gibbed or ME3Explorer before and/or are running into issues here are several useful guides you should definitely check out:

Gibbed - download
Modifying faces in Gibbed
Basics: Modding hair via Gibbed
Scalar / Vector / Texture 
ME3Explorer - download
Tutorial on how to install .MOD files

For those of you that absolutely can't run with texmod but really do want to use this hairstyle no matter what, I'll include a texture replacement .MOD below.
Two things to note though:

  1. This can currently only be replaced as a DXT1 with 1bit alpha, this means I have no gradual alpha and things are either transparent or they're not. This differs from the texmod that includes a DXT5 which features much softer edges. I'll be asking around to see if this is something the guys over at ME3Explorer can do anything about but 0 promises. As it stands that means it will look different from the texmod version. 
  2. Seeing as the BIOG_HMF_HIR_PRO.Hair_Short02.HMF_HIR_PROShort_Diff texture is the one all hair mesh modders use, if you want to switch hairmods, you'll have to either revert BIOG_HMF_HIR_PRO.pcc or run a permament texture replacement .MOD over this one to overwrite it. You can't use texmod on a permanently replaced texture.

I have tried the .MOD but it causes my game to crash to desktop.
a: My advice would be to revert your BIOG_HMF_HIR_PRO.pcc to vanilla and try again.
If you keep experiencing issues make sure you're using rev 472 or above.

I can load un-modded saves but modded saves crash to desktop.
a: This is likely a Gibbed save error.  Make sure there are no extra spaces before or after the codes you have changed.


My support begins and ends with the functionality of my mods. I do not cover the inner workings of the tools you'll need to get acquainted with to use mods beyond giving some general troubleshooting tips. Further problems with them are best discussed on their respective websites or support forums.

Do NOT repack or redistribute these files without permission.

Much thanks to Apachii from the Skyrim Nexus (ApachiiSkyHair) for providing permission to use and share this hairstyle =)

Monday, August 19, 2013

Guide: Creating Texmod Package Files (TPF) for ME Series Games

What is Texmod?

Texmod is a utility to browse, extract, save and modify textures in Direct3D 9 applications.
In order to share and distribute texture modifications, packages can be created which are compressed to prevent further modification.

Saturday, July 20, 2013

MOD: Fauxhawk Hairstyle for ME3

Note that this mod is PC only! You can't replace Meshes on the consoles.

Mesh replacement is still young, use at your own risk =)

This is the Female Hair PCC which includes the permanent replacement of the Mohawk Mesh only. Make sure you run AutoTOC in ME3Explorer after copying the PCC into your CookedPC folder. You will have to run texmod to apply the textures. TPF is also included in the download.

This .MOD will include the permanent replacement of the Mohawk Mesh only. This mod was created with SVN rev 466. It should return 2 updates after you run the job.
You will have to use Texmod to apply the textures. TPF is also included in the download.

Lastly, for those that would like to pick which mesh to replace themselves or that have issues installing via the above methods: I have also uploaded the UPK for manual replacement. Hair texture is also included in the download.


To use this hairstyle on Shepard, do not forget to edit the following values with Gibbed:

Hair_diff: BIOG_HMF_HIR_PRO.Hair_Short02.HMF_HIR_PROShort_Diff
Hair_mask: BIOG_HMF_HIR_PRO.Hair_Short02.HMF_HIR_PROShort_Diff

If you have never used Gibbed or ME3Explorer before and/or are running into issues here are several useful links and guides that can help you out:

Gibbed - download
Modifying faces in Gibbed
Basics: Modding hair via Gibbed
Scalar / Vector / Texture

ME3Explorer - download
Guide: ME3Explorer first time setup information
Tutorial on how to install .MOD files
Tutorial on how to use PCC mods
Tutorial on manual mesh (upk) import


I have run the .MOD but I'm still seeing the old Mohawk mesh ingame.
a: Run the .MOD again. It will likely return with another AutoTOC update and work afterwards.

I have tried the .MOD but it causes my game to crash to desktop.
a: My advice would be to revert your BIOG_HMF_HIR_PRO.pcc to vanilla and try again. You can also try manually throwing away your modded PCC files and repair your install via Origin. This will force a redownload to revert your PCC's to vanilla state. Now overwrite your PCConsoleTOC.bin with your modded backup, then run the PCConsoleTOC.bin updater through ME3Explorer and try again. If you keep experiencing issues make sure you're using rev 473 or above, or consider the PCC release.

I have tried the PCC but it causes my game to crash to desktop.
a: Make sure you ran AutoTOC in ME3Explorer after having copied and replaced the PCC file. If you have, try overwriting your PCConsoleTOC.bin to your modded backup, then run AutoTOC through ME3Explorer. If you keep experiencing issues make sure you're using rev 473 or above, or consider the .MOD or UPK release.

I have tried the PCC but it causes my game to get stuck on loading.
a: This is most likely a PCConsoleTOC.bin error. Try overwriting your PCConsoleTOC.bin to your modded backup, then run AutoTOC through ME3Explorer.

I can load un-modded saves but modded saves crash to desktop.
a: This is likely a Gibbed save error. Make sure there are no extra spaces before or after the codes you have changed.

I have tried to replace a mesh with your upk but it causes my game to crash / does not work.
a: The UPK itself is tested and works. If you've watched the tutorial I linked above, and followed all steps to the letter I can not help you, visit the ME3Explorer forum and ask for help there.

My support begins and ends with the functionality of my mods. I do not cover the inner workings of the tools you'll need to get acquainted with to use mods beyond giving some general troubleshooting tips. Further problems with them are best discussed on their respective websites or support forums.


Many thanks to Apachii from the Skyrim Nexus (ApachiiSkyHair) for providing permission for me to use and share this hairstyle =)


All permissions are specific to this mod. These permissions do not extend to any of my other mods.
This mod contain assets from other authors and can't be redistributed without permission from these authors.

1. You MAY alter this mod for personal use.
2. You MAY NOT redistribute (upload/share) this mod.
3. You MAY NOT use these assets in other mods.
4. You MAY NOT release compatibility patches for this mod.
5. You MAY NOT release localisations for this mod.
6. You MAY use this mod in other creative works (YT videos, 3D Renders, etc) that are subject to ad revenue.
The description of said work must mention that I am the creator of this mod and link to it's project page.

MOD: Fauxhawk Hairstyle for ME3 is not associated with BioWare Corp. or Electronic Arts, Inc. This mod is supplied for free; I make no money from this project. This mod comes without any warranty, to the extent permitted by applicable law. This means you use it at your own risk; I am not responsible for any damage to your game or PC by use of this mod.

All inquiries regarding this mod must be directed to Ottemis via the following locations:

All permissions associated with this mod must be continued to be observed regardless of my presence or absence. If any permissions in this document are dependent upon contacting me, then those permissions are revoked in my absence.

BioWare Continuity Network may keep a copy of this mod within their archives for historical purposes, provided all authorship and credit information is retained and the contents of the mod are not altered in any way.

Monday, July 15, 2013

Tutorial: Porting hairstyles using 3ds 2012

To the effect of being able to edit and successfully import hairstyles into Mass Effect 3, ELE has taught me the basics of using 3dsMax 2012. This tutorial covers what she's taught me, and what we've learned about hair conversion since.
Now obviously the use of 3dsMax is no picnic, so it is very conceivable this won't make much sense to you the first time you try and you will be fiddling with the controls quite some. Be bold!
If you encounter start-up issues, give it some time. Look up some more advanced tutorials etc. What I'm about to put down here will be extremely basic and will expect you to take initiative in getting to know the program.

Getting started

Depending on the source, your hairstyle will have a certain extension. Start by installing the 3ds Max Nif Importer-Exporter (Bethesda) and the ActorX Importer AND exporter for 3dsMax 2012(Mass Effect).

Note: I am using Bethesda files as an example, but any mesh works on the same principles. The nif importer plugin only works for 3DS versions 2012 or below.

Once you've started up 3ds this is what you will see.  I advise you click and watch the first link in the startup screen, it's only a few minutes worth of video.


What we're going to do first (though this is completely optional) is revert to one viewport instead of the standard four. Go to view, viewport configuration, layout. Click the first option, apply, ok.

Let's import a model. Seeing as we're looking into editing hair, how about we grab the female head from ME3, we'll need it to align new hair to later. To make this easy I've uploaded the file here.
This is a psk file, so we'll need to use the ActorX importer you installed. 
Go to MaxScript in the top navigation bar, select run script in the dropdown menu. Browse to the location where you saved, select it and hit open.

Now, in the window that pops up, hit Import PSK... and browse to the location where you saved the female head, select it and hit open. You'll be treated to a top view of the model.

Try moving around the mesh. You can click and hold the left mouse-button to drag your screen and use the scrollwheel to zoom in and out when the viewport is active. In the top right corner of the viewport you'll see a cube that lists all faces, click the faces to snap to them or hold and drag on a corner to rotate and tilt manually. With the wheel under the cube you can rotate view. Try clicking next to the head to deselect it and then re-selecting it and play with the rotation and zoom controls. Take some time to get familiar with it =)
In the top left corner of your viewport you'll notice it says [Top][Realistic], click on them to change them (personally I use [Perspective] but vary on the second). You can try different ones and see how they affect the model. 

Before we continue past this section, change your view/position to something similar to this:

Picking a hairstyle

As we've installed an importer for nif files we're going to limit search to Bethesda game mods. This would include Skyrim, Oblivion, Morrowind and the Fallout Series. Most of these mods use ported hairstyles that originate from other games, most commonly the Sims franchise. Conveniently, you can browse the Nexus sites for these games to check available mods.

Skyrim Nexus
Oblivion Nexus
Fallout3 Nexus
Fallout New Vegas Nexus

I'm going to use the Skyrim ApachiiSkyHair Pack for purpose of this tutorial. Specifically I'll be working with hairstyle number 21 which is a long female hairstyle with a braid and ponytail. Download whichever hair you want to work with, or use the same one I'm using if that's easier for you.

Importing and editing

Files with the .nif extension you can import using 3dsMax's import function. Click the 'start' icon in the topleft corner on the navbar and simply pick Import.

Browse to the location of the mesh you want to import and select the correct file, in my case that's: ..\ApachiiSkyHair_v_1_5_Full-10168-1-5-Full\ApachiiSkyHair_v_1_5_Full\Data\meshes\actors\character\character assets\hair\apachii\female\hair21.nif

Now on the popup window for nif import, uncheck Import Skeleton and hit Import. Your viewport will now realign itself with the newly added mesh! It should show up screen-filling. If you're wondering where the head mesh went, select your viewport and scroll to zoom out:

Now there are several things to note here. The orientation of the mesh is important! As we are modding Mass Effect, the hair needs to be aligned with the position of the head.
Note: The difference between location of the hair and head completely depends on which game the hair was meant to work with. If you for instance port Sims hair, it's conceivable the initial location is different from what I'm showing you here.  

Before we start moving the hair though, we will be removing the skin attached to the hair mesh. We will have to regenerate the skin later, but for now it can interfere with the edits we are about to make so it will have to go.
Select the hair and on the right side of your interface, you'll notice it says skin, above editable mesh.
Right-click and select delete in the dropdown menu.
Note: If you'd rather not reskin from scratch and are working with a Mass Effect mesh, right-click and select cut in the dropdown menu instead. You can paste it back in when you're done editing the mesh.

Navigate around the meshes to get a better view of their position relative to each other. As you can see, the hair is:
1. too small in comparison to the head
2. facing the wrong way
3. at the wrong height

What I've noticed is that when you scale up a mesh, it will automatically move up. So we're going to tackle these three discrepancies in the order they are listed to make sure we don't do unnecessary double work.
To scale up the hair, select it by left clicking it, right-click to open the drop-down menu and select Scale. Your cursor will change icon to a tiny triangle. Now in the viewport ontop of the hair mesh, left-click and hold while moving your mouse up, you'll notice the hair will both scale up and move up simultaneously.

Now to rotate the hair, select it then right-click to open the drop-down menu and select Rotate. Left-click and hold on the mesh and move your mouse to the left or right to rotate.

To move it along the X/Y/Z axis, select it then right-click to open the drop-down menu and select Move. You can try to reposition the mesh with your mouse but I would advise using the X/Y/Z boxes at the bottom of the viewport. There are little arrows next to the input boxes so you can easily move along any axis in small increments.

Use all three (Move, Rotate, Scale) to reposition the hair until you are happy with it's location. You'll want to rotate your view often so you can check for clipping issues more easily (note the ears) and to see how big the gap between the hair and the skull is at several points.

Note: You shouldn't touch the location of the head. If you accidentally move it at any point revert with control-z or select the headmesh, right-click and select move in the drop-down menu, then enter 0 (zero) for X,Y and Z on the bottom navbar.

On my example below you can see I switched to [Perspective][Realistic], as it emphasizes the shadows nicely on the edges of the mesh, so I can easily see the distance between elements. Note how nicely the mesh wraps around the ear. This isn't always the case, I'll cover repositioning of individual elements below this section.

Having done what you can just moving and rescaling the entire mesh, it's time to rework individual parts to fit around the head better.When you have the mesh selected you'll notice on the right of the viewport the selection menu is visible. At the top it shows icons for five ways of selecting parts of your mesh. Vertex, Edge, Face, Polygon and Element. For now select Element. When you click through the various parts of the mesh, you'll notice entire strands lighting up bright red as you select them. You can move them over any axis using the arrows that show up in the middle of the selected element.
Whenever you would like to move certain parts of an element, it is advised to pull that particular element out, then select vertex under selection to move the vertices. This way you don't run risk selecting vertices on different elements than the one you're looking to alter. You can select multiple points by either left-click dragging your mouse over an area or by clicking individual elements while holding control.
If you would like to push or pull an entire area of the mesh out, you can do this by using soft selection. The number belonging to falloff under Affect Backfacing determines how much of the surrounding area is affected. You can see how big the area affected is when you pick vertex under selection. The colour the vertices of the surrounding area determines how much they are influenced.

Here I'm using Polygon selection to push in an area of the mesh closer to the skull, closing the gap by using the y axis arrow. I'm using a Falloff of 5. This is trial and error depending on the area you want affected. Result is on the right.
By selecting a vertex or element and pressing delete, you will completely remove it. Note that this might look weird on the textured mesh ingame. There are some instances however where this is necessary, which I'll illustrate later in this tutorial.

Texturing your mesh

Adding a diffuse and normal

Some might prefer to edit meshes with it's textures applied so I'll add a little section on how to do this. While having your mesh selected press M. This will open up the Slate Material Editor. Double-click your mesh name under Scene Material (1), this will open up the Navigator and fill View1. You'll want to move the active area in View1 via the Navigator (2), position it so the red/green blocks are visible. Now in View1, double-click on the top box (3) that has "textures" and "bitmap" in the name. This will open up the Bitmap Parameters (4). When you click on the texture path right under the header, this will open a file-picker (5). Browse to the textures that came with the mesh download. In the case of my hair the path would be:


Once selected, you'll notice the little icon in View1 changed, but no textures are applied to the mesh yet. Now, double-click the box that has "Norm" in the name from View1. Click the texture path behind "Normal:" in the Parameters box. This will open another menu in the same area that looks exactly like the one you just saw for the first texture (4). Again, click the texture path directly under Bitmap Parameters and browse to the texture location. This should be the same as the first one, and it should default to that location now. You should now see the texture applied to your mesh!

Adding a working alpha

Open up the Material Editor again with M. Double-click the main box, select Blinn in the dropdown menu under Shader Basic Parameters and check 2-Sided.

On your diffuse texture box, check Image Alpha under Alpha source (1). Select the box for the diffuse texture, hold shift and drag and drop to duplicate it (2).
Now drag and drop a ColorCorrection box (3) from the Material/Map Browser into View1 (4). Doubleclick it and change the dropdown values for all the channels to Alpha on the right under Basic Parameters (5).
Click and drag the bubble on your duplicate diffuse (6) and connect it to the bubble on the ColorCorrection box (7). Now connect the other bubble on the ColorCorrection box (8) to the bubble on the main box next to Opacity (9).

Weighting your mesh


Now for the fun part. Remember when we removed the skin at the beginning of this tutorial? We'll be adding it back in now.
It's function is weighting the mesh down according to the bones your mesh is linked to.

You can use whichever mesh you plan to replace ingame and take it's bones for your project. This way the mesh will import without issues and cause no crashes ingame.
The game can become unstable when the number of bones on the mesh you are replacing isn't equal to your new mesh and meshplorer currently does not allow it anymore and will throw an error. Knowing that, use either the human skull, any of the CC hairstyles or for instance Allers hair to steal bones for your weighting dependent on which mesh you plan to replace ingame.

Now on most hairstyles we can simply add a 'head' bone that will automatically affect the entire mesh.
This means that when the characters' head animates, the hair will move with it at the same angle. This is fine for short bobs and updo's but can cause clipping on longer styles. It's also adequate for testing purposes, as we'll need to go ingame a couple of times and test out our hair and subsequent changes on (an unwilling) Shep.
Select your mesh. Above Editable Mesh on the right of the viewport you'll notice it says Modifier List with a dropdown arrow. Click it and type in "skin". This will jump you down, select Skin there. Now under Parameters press the Add button next to "Bones:", highlight Head in the popup window and press Select.

To actually see what just happened, press Edit Envelopes right under Parameters, you'll see the entire hair mesh turn bright red. Red indicates that it is fully affected by the selected bone, which in this case is the Head bone. You'll notice it also displays the actual bone inside of the mesh with axis arrows attached to it.


Using skin-wrap we can copy the weights of another mesh onto the one we've created. In terms of meshes that generally have the same shape and are not horribly complex, this method will do nicely.
What we want to do is find an existing mesh that has about the same length, let's say.. Allers hair. To make this easier, I have uploaded the hairstyle here.

As explained earlier, psk files are opened through the ActorX Importer under MAXScript, Run Script. Import the hair you just downloaded. Now select your own mesh. In the Modifier List type in "skin" and select Skin Wrap.

Under Parameters, you'll see an empty box with an Add button below it. Click it and select the other mesh. In this case it should add HMF_HIR_PROJessica_MDL to the previously empty box now.
Click Add again to remove the highlight, make sure Weight All Points is checked, then click the Convert To Skin button at the bottom of the Parameters box. You'll now have skin and skin wrap listed above editable mesh, you can remove skin wrap.


For the masochists among us, manual weighting explained in short. I want to use the bones that come with the Allers mesh, so I'll be opening that one again and deleting the hairmesh. As before, ActorX Importer under MAXScript, Run Script.
We'll add the Skin modifier, then add two bones to the envelope: Head and LeftCollar.

Select Skin above Editable Mesh, In the list of Bones, select Head. Click on Edit Envelopes so you can see which area of the mesh the bones affect. As you might have noticed, the Head bone affects the entire mesh, we'll want some of the lower parts affected by the Collar-bone so we minimize clipping, so select LeftCollar now. See where the bone is? Right on our ponytail.

Scroll down to Weight Properties and uncheck Paint Blend Weights. Now you'll see a little wrench-tool icon there, click on the Paint Weights button right under it. When you move your mouse over the mesh now, your cursor will change. There are two ways we can adjust the brush: in size and strength/opacity. To adjust the size, hold control and shift while you drag and hold your left mouse-button up or down. You'll notice the brush changing size and it affecting the displayed radius number. To change the strength of the brush, hold shift, control and alt while you drag and hold your left mouse-button up or down, you'll notice the value for strength changing.
Now let's paint some weights! Red is fully affected, yellow less so, blue etc. A softer brush will allow you to create smoother transitions. You can switch between head and leftcollar if you make a mistake. You'll notice that whichever area you painted over on the leftcollar is now reflected on the head. Aim for something like this:


Exporting and testing your mesh ingame

First, delete the head mesh out of your project, you can leave the bones. Just select the head and hit delete. Now to export your hair, click the utilities tab on the right navbar.
Click on More..., select ActorX and hit OK.

This will open an export menu in the right navbar. Select an output folder and type in a name for your mesh. Scroll down and uncheck bake smoothing groups, now you can hit Save mesh/refpose.

Now watch the following tutorial by WarrantyVoider for the remaining steps on how to get your mesh into the game. For reference, the PCC files containing the hair are as follows:
BIOG_HMM_HIR_PRO_R.pcc (male) and BIOG_HMF_HIR_PRO.pcc (female)

Do NOT skip a step when importing and saving va the UDK. You will need your mesh to be a UPK package, not a PSK when you import into the game via ME3Explorer.  

Converting the hair texture

I use photoshop for this. As Mass Effect uses it's own system for the recolouring of hair to conform to CC colours, you'll need to convert your texture to work correctly in the engine.
There's a simple way of doing this. Open the texture in Photoshop, add a new layer and paintbucket it #008e00. Now doubleclick the layer and select Multiply as the blend mode.
Save as a DDS: DXT5 with integrated alpha. If you can't you're probably lacking the plugin, you can get it here =)

To create a texmod .TPF for the hair, the identifier to replace the deprecated ME2 custom cute hair textures is 0x487289A3. For a tutorial on creating a texmod .TPF, check here.
To use the custom cute textures on the Shep that's testing the Mesh, use Gibbed and change the texture values for Hair_Diff and Hair_Mask to BIOG_HMF_HIR_PRO.Hair_Short02.HMF_HIR_PROShort_Diff 

Note: If you have any transparency issues ingame, you'll have to check the alpha channel on your texture. It might be that the contrast is too low and your white's not really white in which case the game will make the entire hair slightly transparent.


Troubleshooting texture problems

When you go ingame to check your mesh, there are several potential problems with mesh-imports that aren't always easy to spot in 3dsMax.

This picture shows the first I want to cover nicely. This weird lighting issue you are seeing has to do with duplicate strands overlaying eachother in the mesh. There are a few tricks to spotting these early and ways of fixing the issue.

In 3dsMax, when you have enabled the alpha texture layer, you might have noticed a weird transparency issue with some of the elements. It's easy to spot on this particular mesh as the elements are quite large on the top of the head.

If you haven't applied textures at all, switch to [Perspective][Consistent Colors] and you might notice weird blotchy spots on the mesh. It SHOULD be evenly tinted in either white or grey per element.

Thirdly and consistently, when you select the mesh and use the Element selection tool, you'll notice when clicking some strands that they are in fact dark red instead of the normal bright red. I'll emphasize the difference with an image comparison below:

From what I can gather, the darker colour indicates the back of an element. When the back is exposed in Mass Effect 3's engine, the lighting on it sort of inverts itself which causes the weird blackness. It can also cause weird streakyness in thinner strands with alpha transparency. Seeing how some strands will either curl around and reveal all sides from one perspective or show it's back some other way, you'll have to decide on a case by case basis whether to completely remove or simply edit elements when trying to fix this issue.

Simply click on an element and it will cycle through both overlayed elements. Select the darker red one and hit delete. You'll need to be careful you don't create any bald spots while deleting strands.
Also check out the following method of dealing with these strands by andrastessanctifiedgirdle on Tumblr who explains how to easily flip them as an alternate to deleting or moving them.

If you still see some areas of the hair ingame where the strands don't look right, make a couple of screenshots so you know where this is happening and go back into 3ds.
In much rarer cases you'll notice that when you pull a strand out, it will be weirdly connected and stretch another strand as you pull! Control select the second strand as well, then pull them both further out. You'll want to switch from element to polygon selection and select those stretched bits and delete them. They are sometimes connected to another normal strand but not always, if they are let the normal elements be.

Note: Save your project as a max file, so you preserve the skin and weighting settings between exports. This will be better to load in inbetween small edits then working with your exported mesh.

Have fun and good luck =)