Jump to content

Welcome to Obsidian Forum Community
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

[Tutorial] How to edit assets and assetbundles.

Tutorial How to asset assetbundles assetbundle bundle UABE

  • Please log in to reply
11 replies to this topic

#1
Fhav6X

Fhav6X

    (2) Evoker

  • Members
  • 67 posts

This is a 2nd level Tutorial on how to edit assets and assetbundles.

 

Tools
- Unity Assets Bundle Extractor
https://7daystodie.c...undle-Extractor
- Text editor (e.g. notepad++)
- Asset Studio
https://github.com/P...Studio/releases
- paint, gimp, photoshop, paint3d, blender

0. What is a 2nd level Tutorial?
PoE2 has three levels at which one can mod the game. Level 1 is modifying the gamedatabundles, stringtables etc. Let's call it scripting and shuffling of existing things. You can't add totally new stuff or change the game mechanics. Level 2 allows you to add self made contend (new npcs, new hairstyles, new look etc.) just like a DLC. Level 3 is changing the game mechanics. In other games this is called the "hard coded" level and is normally not accessible to moders.
Level 1 has no influence on level 2 or 3. Level 2 has no influence on level 3 but on level 1. Level 3 has influence on level 1 and 2.

1. What are assets and assetbundles?
The Unity engine stores all files required to display anything in the game (animations, areas and character meshes, some scripts, visual maps, variable lists e.g. for companion stats) in so called assets and assetbundles. The asset files are the "levelxy" or "sharedassets" in the "PillarsOfEternityII_Data" folder. Assetbundles are the unity3d files in the "PillarsOfEternityII_Data\assetbundles" folder.
The "levelxy" and "sharedassets" contain mainly areas and maps and the interaction between all the stuff on it (npc, quest and sequence triggers). So if you want to edit/build maps this are the once you need to get familiar with. The assetbundles in "PillarsOfEternityII_Data\assetbundles\streamtile" contain the textures for the areas and maps.
The focus of this tutorial will be the assetbundles in "PillarsOfEternityII_Data\assetbundles". The contain the stats and appearance files for all items, characters, creatures and the UI. They have mostly convenient names. The ones that start with "lax" are the expansions and DLC's.

2. How to mod assetbundles?
2.1 UABE and Asset Studio
In order to modify assets or assetbundles you need Unity Assets Bundle Extractor (UABE). It is the only tool I know, which can import files into existing assets or assetbundles. UABE is not very helpful for browsing the files. This is where Asset Studio shines. It can give you previews of files without the need for extraction and external programs.

2.2 Things you need to do, before start modding.
The big unity3d files are "compressed"!? Not really, but you will have to "uncompress" them. UABE has a protection build in to prevent unwanted overwrite. To make your life easy just do this ALWAYS!!! when modding an assetbundle.

- take the unity3d file you want to "uncompress" or mod and name it name2.unity3d
    e.g. characters.unity3d --> characters2.unity3d
- open characters2.unity3d in UABE via File -> open
- if you haven't "uncompress" the file you will be prompted to do so.
- save the file as characters.unity3d without the number.

Now you have two files, a backup with a number and one modded, which is used by the game.
PS: there is no need to "compress" those files.

2.3 The file structure inside the assets or assetbundles.
Use UABE or Asset Studio to open the assets or assetbundles. You will see many different file types. If you already know, how to mod gamedatabundles, you will recognize monobehavier files with "prefab" in their names. This prefab files are text files containing, how all the other files are put together. They are the assembly instructions.  

Here is an example, I will use in this tutorial. It's the prefab for the female Godlike head 1. Practically all visual object prefabs can be found in "items.unity3d".

Spoiler

 

It looks like a lot, but it is more simple than it seems. If you want to change the appearance of anything in the game the cyan part is the most important. The locations of all necessary files are under "FBXModelData ModelData". The strings are all references to files in characters.unit3d. The next important part is "SubMeshSettings SubMeshes". Here are the meshes used and under "MaterialOverride" is the reference of their color files. When you open those meshes and material files, you will see the same structure and references to object (fbx), skeleton, and texture files.

2.4 Referencing in the assets or assetbundles
I have used the term reference very often in the previous section. There are 3 ways to reference something in the assets or assetbundles.

    1. Reference by name (eg. string MeshName = "F_GODM_Head01")
    2. Reference by SInt64 m_PathID. When you open an asset or assetbundle in UABE and click on "Info" a window called "Asset info" with all the files in the asset will open. In this Window there is a tab called "PathID". This is the SInt64 m_PathID of the file. If you want to find a file mentioned in the prefab or other files, copy SInt64 m_PathID, open the "Asset info"-window of the asset, click on view, select file id (there is only one), fill in the path id and click ok to find the file.
    3. In some cases we have files referenced across assets and assetbundles. The prefab files are in items.unity3d and reference to characters.unity3d. I have not figured out yet, how this is done. Presumably it has something to do with a file in every asset with the path id 1 and/or the "UnityAssetGuidString".


Edited by Fhav6X, 22 September 2018 - 03:22 PM.

  • Grape_You_In_The_Mouth and NocturnalTrance like this

#2
Fhav6X

Fhav6X

    (2) Evoker

  • Members
  • 67 posts

3. Time to mod!
I will now mod the female Godlike head 1 to look a little different.

3.1 Rename items.unity3d (if you have not "uncompressed" it), characters.unity3d and character_headandskin_hd.unity3d. I named them items3.unity3d (if you have not "uncompressed" it), characters3.unity3d and character_headandskin_hd3.unity3d.

Spoiler

3.2 Make a work folder somewhere.
3.3 Open UABE -> open items3.unity3d -> save the "uncompressed" as items.unity3d -> open items.unity3d -> click info -> resize "Asset info" to your liking -> look for MonoBehaviour a_F_GODM_Head01 -> click "Export Dump" -> save the file in your work folder. The file name contains the Assets md4 hashed name and the Path id (none negative).

Spoiler


I won't change and import a_F_GODM_Head01 back. But it is easier to look up the SInt64 m_PathID this way. If you wish to use different/custom models you have to edit this file too.

3.4 I will only change the colors of the actual head, so I just need the SInt64 m_PathID from

        string MeshName = "F_GODM_Head01"
        PPtr<$Material> MaterialOverride
            int m_FileID = 1
            SInt64 m_PathID = 8442848947353014589
            
3.5 Open UABE -> open character3.unity3d (mine is already "uncompressed") -> click info -> resize "Asset info" to your liking -> click on view -> select "go to asset" -> fill in the file id and under path id 8442848947353014589 -> click "View Data" -> a window will pop up.

Material files are like prefabs for texture. I will not edit this file, just the textures it references.

3.6 In the window expand to "UnityPropertySheet m_SavedProperties/map m_TexEnvs/Array Array/2/_MainTex and note the SInt64 m_PathID = 8053650484694347279.
Spoiler

3.7 Now look for this file via "go to asset" -> click on "Plugins" -> select "Export to .png" -> save the file in your work folder. DO NOT CLOSE UABE!!!! Well, you can close it, but it's easier this way.

Spoiler

3.8 Edit the file to your liking. I use gimp for that.
3.9 With UABE still open and pointed, at the file click on "Plugins" again -> now select "Edit" -> a new window opens -> click on "Load" under "Texture" -> select your edited file -> confirm everything.

I want to give the moon godlike the horns of a nature godlike. For that I will replace the horns object files.
3.10 Look for F_GODN_Head02_Horns in character3.unity3d (there are models for each race) -> select all of them and click "Export Dump" -> now look for F_GODM_Head01_Horns click "Import Dump" and import F_GODN_Head02_Horns for the corresponding race.
3.11 In the "Asset info" window select "File" -> save -> OK -> "Asset info" closes.

Spoiler

3.12 In UABE select "File" -> SAVE!!! (not export) as "character.unity3d" without the extra number from before.

Spoiler

PoE2 has extra hd textures in character_headandskin_hd.unity3d so I will edit those too. The textures have the same name as the ones in characters.unity3d but with a "_HD" at the end.

3.13 Open UABE -> open character_headandskin_hd3.unity3d and repeat Step 7 to 11.

Almost finished.

3.14 Launch PoE2 and go to character creation.

Spoiler

4. FAQ
Q: Can we create own files?
A: Yes and no. There is currently a problem in UABE with new MonoBehaviour files like the prefabs, that prevents creating entire custom things. Any other file type can be created.

Q: Can we make install packages?
A: Yes, UABE offers this. I recommend to make a readme with all edited SInt64 m_PathIDs for mod compatibility.


Edited by Fhav6X, 07 October 2018 - 02:37 AM.

  • Grape_You_In_The_Mouth, MaxQuest, Ethics Gradient and 1 other like this

#3
aledroid

aledroid

    (1) Prestidigitator

  • Members
  • 11 posts
  • Deadfire Backer
  • Fig Backer

Thank you for this tutorial! 

 

I wanted to change the skin tone of godlike and I imagine I should be able to do that just by altering the texture as you did. 

 

If I wanted to switch a model for another how would the process work? UABE doesn't export obj, right?


  • mysterioustoast likes this

#4
Fhav6X

Fhav6X

    (2) Evoker

  • Members
  • 67 posts

Thank you for this tutorial! 

 

I wanted to change the skin tone of godlike and I imagine I should be able to do that just by altering the texture as you did. 

 

If I wanted to switch a model for another how would the process work? UABE doesn't export obj, right?

 UABE can do this the same as with pictures. But for swapping models, you just have to redirect the paths in the prefab, or (for single parts) replace the model files, like I did in 3.10 and 3.11.

 

As soon as I figure out, how to create prefabs, I will make a tutorial for entire custom models.

 

Skin color change can be done by editing the material files of the models. They have sections called "_TintMap", "_TintColor1" and "_TintColor2". If there is no file for the "_TintMap" you can just enter the color numbers for your color under both "_TintColor1" and "_TintColor2". The color numbers for red green and blue are the rgb numbers of a color (look them up in paint) divided through 255.


  • Grape_You_In_The_Mouth and mysterioustoast like this

#5
Excerpt

Excerpt

    (2) Evoker

  • Members
  • 61 posts

So using this method it is currently not possible to ADD new items/armors/weapons using this method because of problems with creating new Monobehaviors? Am I understanding this right? What is the problem exactly with creating new Monobehaviors/Prefabs for use in the game? Could you just copy an existing one and modify it or would that also not work?



#6
Fhav6X

Fhav6X

    (2) Evoker

  • Members
  • 67 posts

There are multiple types of Monobehaviors. When a new one is created in UABE, the program reverts it always to the default type of these and in so doing, cutting off areas needed for the extra information of the prefabs.

 

There might be a way to "add" new items/armors/weapons. I have seen a lot of poe1 stuff in the bundles. One could recycle those for new things in poe2.


  • Grape_You_In_The_Mouth likes this

#7
blackstone777

blackstone777

    (1) Prestidigitator

  • Members
  • 14 posts

@Fhav6x

 

I have sucessfully edited a soulbound weapon's .unity3d file (using UABE and Notepad++) to include an additional class (Druid).

 

I have imported the change I made (using Notepad++) back into the original .unity3d asset bundle.

 

But upon exporting that new file all I get is a "file" extension, that is, a file with no .unity3d extension.

 

So my question is, how do I get that newly edited asset bundle to be recognizable and usable by PoE as a legitimate .unity3d file?

 

*EDIT*

 

I figured it out :)

 

What I wasn't doing was saving the renamed .unity3d file as the originally named PoE file WITH THE .UNITY3D extension FIRST, before dumping what I wanted to edit and then importing those changes.

 

I was using the "export" option instead and the game would not recognize the file even if I tried to add the .unity3d extension after making proper edits using the export option.

 

Very easy to mod now!


Edited by blackstone777, 06 October 2018 - 10:51 PM.


#8
Fhav6X

Fhav6X

    (2) Evoker

  • Members
  • 67 posts

I have now marked under 3.12 that you have to save and not export the finished file.

 

If you do it as I suggested you just have to mark the numbered unity3d file when saving and remove the extra number. This way you always correctly name the file and file extension.


  • blackstone777 likes this

#9
Starrceline

Starrceline

    (1) Prestidigitator

  • Members
  • 5 posts
  • Deadfire Silver Backer

I just started using these mod tools today, thank you for sharing them. I am halfway through editing Maia's appearance. I successfully edited the character_headandskin_hd.unity3d file, but when I go to edit the characters.unity3d file, it crashes the AssetBundleExtractor. I can only open the file, but as soon as I click "Info," it crashes the program. Any idea what to try?



#10
Fhav6X

Fhav6X

    (2) Evoker

  • Members
  • 67 posts

@Starrceline

Odd? I can open all unity3d files without problems.

 

What version of UABE do you use? I use the latest (2.2 beta4).


  • Starrceline likes this

#11
Starrceline

Starrceline

    (1) Prestidigitator

  • Members
  • 5 posts
  • Deadfire Silver Backer

It seems I am running a measley v 1.0...I will look into updating this, thank you!



#12
Starrceline

Starrceline

    (1) Prestidigitator

  • Members
  • 5 posts
  • Deadfire Silver Backer

Upgrading my version to 2.2 beta 4 worked like a charm!

This is great! My first time ever modding a game skin like this. But now I changed something I didn't like in a character skin :)







Also tagged with one or more of these keywords: Tutorial, How to, asset, assetbundles, assetbundle, bundle, UABE

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users