Ace Combat 7: Skies Unknown

MREC/Normal Map Splitting Guide

Version 1.0

By @Dantofu


Table of Contents

Table of Contents

1. Requirements

2. Preface

3. Objective

4. Starting UE4 Editor

4a. Setting Up The Workspace

4b. Setting Up The Assets

4c. Setting Up The Material (Instance)

5. Hex Editing

6. Putting Everything Together

i. Some Remarks About Filepaths

ii. Closing and Credits


1. Requirements

  1. Knowledge of texture replacement. This guide will work on the assumption that the reader has replaced textures in Ace Combat 7 before and is familiar with the game’s filetree structure. They can be found here or here.
  2. UE4 Editor 4.18 - 7GB custom build courtesy of @RythusOmega. Source tweet for the build. Epic Games account, launcher or connection is not required for this build.
  3. HxD Hex Editor - via their main website.
  4. Decrypted Instance files - via MEGA.


2. Preface

MREC (Metallic, Roughness, Emissions, Custom Data) is an image texture file that determines how the lighting interacts with Diffuse texture, and is responsible for some of the cooler effects on aircraft such as MiG-21bis’s Pyro, MiG-29A’s Jester, and ADF-11F’s Metallic Red liveries.

Understandably, Project Aces reuses the same texture as many times as possible to save on disk space. MREC is commonly shared among multiple skin slots as follows:

Skin #1 (Osea) is shared with #4, 5, and 6 (Mage, Spare, Strider).

Skin #2 (Erusea) and #3 (Special) are shared with respective NPC skin slots.

DLC skins can reuse existing MREC, if it makes sense to do so.

Because of MREC reuse, replacing one of them can affect MREC on other skin slots, which can lead to lighting conflict if multiple modded Diffuse textures share the same MREC.

Normal map is bump mapping that uses colors on image texture (Similar to MREC) to simulate 3d bumps on a 2d surface. On aircrafts these could be rivets, vents, panels and so on. Since there is no reason to modify this, only one Normal map is per aircraft, shared across every skin slots.

  • Only exception is F-35C Skin #3 (Special), which has its own Normal Map with more pronounced bump effects.


3. Objective

This guide eliminates MREC and/or Normal reuse so that every aircraft slot can get its unique lighting and bump maps, greatly expanding texture replacement options.

It works by telling the game to load replacement textures from different filename/directory instead of existing one. For most users simply splitting MREC will meet their needs, and have the game load Normal map textures on default directory.


4. Starting UE4 Editor

Download the .rar file provided in the link above. Extract the .rar in desired location.

The actual UE4 Editor executable is located in Engine\Binaries\Win64\UE4Editor.exe.

Create a new project (Or use existing one, if so desired) with desired Folder and Name. Starter Content is not necessary and will only bloat up space.

4a. Setting Up The Workspace

The default window when starting a new UE4 Project. Only the Content Browser (Highlighted) matters for this guide.

Set up the Content Browser’s filetree in exact order and length as Ace Combat 7’s filetree. This is necessary to generate the correct hex values later.

This guide will use F-16C as an example.

4b. Setting Up The Assets

Import images by dragging files into the Content Browser, or clicking on the Import button. Only the asset name matters. Original file name, size, format are all irrelevant, therefore even a single pixel image will work as throwaway assets.

Above image shows the setup for F-16C that will replace Skin #1 (Osea). Keep in mind that folder names start at 00 (Skin #1 Osea) due to array indexing.

All three Diffuse, MREC, and Normal texture assets must be imported and saved, even if not all of them will be replaced. This is necessary for hex editing process, as values referencing those assets are still needed.

For assets that will not be replaced, use base names for those. Therefore, Normal map will be named f16c_00_N and Diffuse texture as f16c_00_D.

Replacement MREC has been named f16c_x0_MREC. However, it can use any names as long as it matches 12-character length of original MREC filename. f16c_new00_M, f16_super_MR, and AAAAAAAAAAAA are all valid as they are all exactly 12 characters.

Repeat the import process for the remaining folders, renaming the copied assets to match the folder they are copied into.

For NPC textures, the situation is a little different. Due to the way decrypted Instance files for NPC skins are set up, MREC and Normal maps must go into folders with two-character length (Player’s). Otherwise, the extra character in the filepath (+1 character in folder name, +1 in asset name) will cause a length mismatch when it comes to hex editing.

This guide uses another folder named “ex” (Extras) to store NPC textures, but as long as the name length matches two character for folder name and 12 characters for MREC (9 for Normal Map) asset names, any other option will work as well.

4c. Setting Up The Material (Instance)

Make sure that every imported asset is saved. Unsaved assets will have an asterisk (*) in the lower-left-corner of the preview. Either right click on the asset to save it, or click on Save All button to save every unsaved asset in the project (It will show a window listing every unsaved asset prior to saving).

Material assets will ignore unsaved textures, even if the Material itself is saved.

Create an empty Material by clicking “Add New” or right clicking on the Content Browser, and name it f16c_00_Inst. This material asset controls which textures will be loaded for Skin #1 (Osea).

The name MUST match this format with 4/6-character aircraft name, 2-digit number for skin slot, and “Inst” suffix for Instance file. Otherwise the game will not detect it and use default textures instead.

For example, Instance file for ADF-11F Skin #1 (Osea) must be named adf11f_00_Inst and saved inside 00 folder.

Double click on the Material asset to launch the Material Node Editor.

Click and drag Diffuse, MREC, and Normal Map texture assets in Content Browser into the Material Node Editor. No further changes are necessary, so save and close the window.

Repeat step 4c as many times as necessary. Make sure textures brought into Material Editor are the “correct” ones, as in texture assets meant for Skin #1 should be used for Skin #1 Instance file, instead of say for Skin #2.

Materials in UE4 Editor do pretty good job updating themselves should texture names or settings be changed. If not, then reopening the Material in Node Editor and re-saving should update the references properly.

For full roster each aircraft should have 6 Instance files for Osea, Erusea, Special, Mage, Spare, Strider + 1 file for DLC (Where applicable) + however many for NPCs. But there is no reason to create Instance file for every single skin if there are no plans to ever use it—this only ends up creating more work later in hex editing.

Double check that all assets (Textures and Materials) are saved in UE4 Editor. Afterwards, feel free to close the program. The assets will be saved in the following directory:

Unreal Projects \ [Project Name] \ Content

For purpose of MREC/Normal Map splitting, cooking the content is not necessary, as the necessary hex values are already available. Cooked Instance files also contain the same hex bytes, so both will work.


5. Hex Editing

Please read this process thoroughly. It is easy to get distracted and make mistakes that can be hard to track down.

Three files will be involved for hex editing, with only one file undergoing actual edits.

Instance file made in UE4 Editor

Copy hex bytes

Decrypted .uasset Instance file

Paste and edit hex bytes. Will be renamed and used in repack.

Decrypted .uexp Instance file

No edits. Will be renamed and used in repack.

There will be 4 pairs (8 files total) of decrypted Instance files in the zip file.

f22a_00_Inst.uasset/uexp

4-character Aircraft folder name, Player slots

a10a_01a_Inst.uasset/uexp

4-character Aircraft folder name, NPC slots

adf11f_00_Inst.uasset/uexp

6-character Aircraft folder name, Player slots

adf11f_02a_Inst.uasset/uexp

6-character Aircraft folder name, NPC slots

Be sure to copy the right pair (Both .uasset and .uexp) for each folder. There should be no change in hex length once the process is finished.

Opening HxD will open the editor with blank window.

Click and drag into the editor window the Instance file made in UE4 Editor (In this case, f16c_00_Inst), and decrypted Instance file that matches the character length (f22a_00_Inst).

For those who used hex editing to replace textures in Ace Combat 7, this will be a familiar sight. For those who have not, these may look like a lot of crap to deal with, but hex editing Instance files is largely a consistent process that gets easier the more often it is repeated.

Here is the breakdown of hex bytes in Decrypted f22a_00_Inst file referencing Diffuse, MREC, Normal, and Instance filepaths, separated into four blocks.

The filepaths should be edited to match the one made in UE4 Editor. Clicking on the decoded text and typing will automatically replace the texts and update the corresponding hex values without changing the overall text length.

HxD will highlight any changes in red to help distinguish from the rest, until the file is saved.

Notice how each block starts with one random byte followed by three 00 (dots). They will be useful in determining where the current block ends and next block starts.

Here is the same image, but with the last four bytes of each block highlighted in black. They will also have to be replaced with the corresponding bytes from the Instance file made in UE4 Editor.

There is a 2nd section in the same file. Further down there will be four additional references to Diffuse, MREC, Normal, and Instance filenames, which will need to be updated to match as well.

And again, the last four bytes of each block highlighted in black.

The necessary hex values will be different depending on filepath characters (Modifying even 1 character in filepath will change the bytes), but every Instance .uasset files created in UE4 Editor will always have those eight blocks, provided that the Material setup was done correctly.

Here is the table for f16c_00_Inst, which was made in UE4 Editor earlier. Near the bottom of the picture there should be a familiar setup seen in Decrypted f22a_00_Inst file.

The reference blocks highlighted again. Bear in mind that the references in both 1st and 2nd section may not always come in the same order.

Highlight and copy the last four bytes from each reference block in f16c_00_Inst. Go to f22a_00_Inst, highlight the same area, and paste the new bytes.

Make sure that they are the bytes from the same section (f16c 1st Diffuse → f22a 1st Diffuse, f16c 1st MREC → f22a 1st MREC, f16c 2nd Diffuse → f22a 2nd Diffuse, and so on.)

Do the same for the 2nd section.

Check that the new filepath and last four bytes of all 8 blocks are correct. Once completed, save the new f22a_00_Inst.uasset file as f16c_00_Inst.uasset, and place it into 00 folder.

Take the decrypted f22a_00_Inst.uexp into the same 00 folder, and rename it into f16c_00_Inst.uexp. This is all that’s required for .uexp files.

Make sure that it is the matching .uexp file. Trying to use a10a_01a_Inst.uexp or adf11f_00_Inst.uexp with f22a_00_Inst.uexp will cause the game to crash when attempting to load the texture.

With this new f16c_00_Inst file in place, it will tell the game to load the Diffuse, MREC, and Normal Map textures for Skin #1 (Osea) in the following filepath:

Diffuse

Vehicles \ Aircraft \ f16c \ 00 \ f16c_00_D (Base filepath, unchanged)

MREC

Vehicles \ Aircraft \ f16c \ 00 \ f16c_x0_MREC (New filepath)

Normal Map

Vehicles \ Aircraft \ f16c \ 00 \ f16c_00_N (Base filepath, unchanged)

f16c_00_MREC will continue to exist in 00 folder and used by Skins #4, 5, 6 (Mage, Spare, Strider), but Skin #1 (Osea) will now use f16c_x0_MREC instead of f16c_00_MREC, as long as actual texture file with a matching name is loaded into the game.


6. Putting Everything Together

Since the f16c_00_Inst will load Diffuse and Normal Map textures using default filepath, they are not necessary for the repack process.

The Instance files and new MREC can even be repacked in two separate .pak files. If the Instance file is loaded but new MREC is not, the game will simply not load the MREC at all, replacing it with default UE4 grey checkerboard texture, losing any weathering, glossy, and metallic effects the skin once had.

Here is one example of Instance file gone wrong. This is caused by byte mismatch (99% of time it’s due to a typo), and as a result the game cannot find the new textures and falls back to the default UE4 grey checkerboard texture. Byte length mismatch will crash the game.

.uasset, .ubulk, and .uexp files for each replacement texture must all be included in the .pak for Skin slots using Instance files. Missing any one of the three will cause the game to either break the texture or crash to desktop when attempting to load the replacement texture. This applies to new textures utilizing both default and new filepaths.

If everything went well, F-16C Skin #1 (Osea) should have its own MREC that is not applied on Skins #4, 5, and 6 (Mage, Spare, Strider). The above image shows ADF-11F Skin #7 MREC (DLC) applied to F-16C.

The .pak file demonstrating this effect is included in the Decrypted Instance assets zip file in Fun Times \ F16C_InstanceTest_Skin1.pak. Feel free to open the .pak file and examine the contents.


i. Some Remarks About Filepaths

As demonstrated in this guide, Instance files are heavily dependent on getting the correct length for filepath filename. While it is conventional to use the same filepath that Ace Combat 7 uses to load textures, the only actual requirement is that the filepath uses the exact same number of characters as filepath used in Decrypted Instance files.

So the following three directories…

...are all valid filepaths for Player skins using 4-character folder names, as they are all exactly 26 characters long.

The next three entries...

...are also valid filenames for its MREC, as they match the original’s length of 12 characters.

The above image shows F-16C Skin #4 (Mage) using MiG-29A Skin #3 MREC (Special) and F-35C Normal Map, all using different filepaths and filenames.

The .pak file demonstrating this effect is included in the Decrypted Instance assets zip file in Fun Times \ F16C_FilepathTest_Skin4.pak. Feel free to open the .pak file and check the contents.


ii. Closing and Credits

I’d like to give thanks to @RythusOmega on Twitter for his initial posts regarding splitting MREC/Normal Map, and a mystery person for providing the decrypted Instance files.

And to the Ace Community community, for their continued support, discourse, and encouragement.

And to Project Aces and Kazutoki Kono, for delivering the finest Ace Combat experience yet.