TOOLS NEEDED
AssetRipper
-- The FBX I ripped using AssetStudio and exported from Unity worked in-game, but I couldn't get it to work when passed through Blender. I think AssetStudio loses some data, compared to AssetRipper.
UABEA
Unity Editor 2020.3.47f1
-- Rogue Legacy 2 devs actually used 2020.3.35f1, but I guessed wrong and 3.47f1 worked.
Blender 3.4
--Install the import/export addon before you begin!
Better FBX Importer & Exporter
-- $28, but I couldn't get it to work without this
I did trial and error using Blender without the addon and 3DS Max, but I could never get it to work. I might document the results of what DIDN'T work at a later date. It would be nice to be able to do this using only free software.
-=INSTRUCTIONS=-
1. Backup the "models" asset bundle located in Rogue Legacy 2\Rogue Legacy 2_Data\StreamingAssets\AssetBundles. Save this and all other working files in a Rogue Legacy 2 Mods directory somewhere on your hard drive.
ASSETRIPPER
2. In AssetRipper, open the "models" file and export all files. (It must be the original "models" file. Modified ones give an error.)
UNITY
3. Create a new Unity project using editor version 2020.3.47f1.
4. Right-click in the Project panel and Import New Asset. From the AssetRipper exports, select:
geoHeadgear_mage.asset
Player_Model_AnimationSetA.prefab
Player_Model_AnimationSetAAvatar.asset
5. Drag Player_Model_AnimationSetA.prefab into the Hierarchy panel. In the Inspector, to the right, click the bullseye symbol next to where it says "Missing (Avatar)" and select Player_Model_AnimationSetAAvatar.asset.
6. In the Hierarchy panel, alt-click the right-pointing triangle to the left of Player_Model_AnimationSetA, to expand its contents. Scroll down and select geoHeadgear_mage (under geoClassOutfit_mage). In the Inspector panel, click the bullseye next to "Missing (Mesh)" and select geoHeadgear_mage.
7. In the Hierarchy panel, right-click on Player_Model_AnimationSetA and select Prefab > Unpack Completely. You'll see the items under it change from blue to gray.
Now select geoAllClasses, scroll down, and shift-click on geoLegs_lancer to select those two and everything in-between. Delete.
Delete geoArm_mage_l and geoArm_mage_r.
Delete everything from geoLegs_mage to geoUmbrella.
Under root, delete everything between main and waist, between waist and spine1, between spine1 and spine2, between spine2 and head, between head and helmet, between helmet and mageHat1, between mageHatBrim and mageBeard1, and everything below mageBeard2. You should be left with only the files needed for geoHeadgear_mage. See screenshot below:

Now, right-click on Player_Model_AnimationSetA and select Export To FBX. Set the Export Path to somewhere in your Rogue Legacy 2 Mods directory. Export Format: Binary. Check Animated Skinned Mesh.

BLENDER
8. Import the FBX you just exported from Unity.
In Blender 3.4, delete the cube, camera, and light from the default scene. File > Import > Better FBX Importer.
Set Rotation Mode to XYZ Euler, uncheck Auto Smooth, uncheck Automatic Bone Orientation, set Smoothing Groups to Import from File, and uncheck Edge Crease. See the screenshot, because I may not be changing default settings at this point, so there may be more you have to change. Just make sure it matches the settings in the screenshot.

Some of these settings may not be necessary, but this is what worked for me.
9. Delete Unwanted Parts
In the Scene Collection panel, shift-click the arrow next to Collection to expand the hierarchy.
Double-click on Vertex Groups. You should then see a panel below that shows five groups. In that box, select mageBeard1 and click the minus symbol to the right of it. Do the same for mageBeard2.
Up in the top-left, under the File menu, you should see Layout is currently selected. Click on Modeling to edit the mesh. When you do that, the dropdown that says Object Mode should change to Edit Mode.
I don't know why it's sometimes tricky to get Blender to do this, but you have to switch to Modeling and have Edit Mode in the dropdown to see the smooth model change into one covered with a wireframe made of triangles with black circles for the vertices. When you're in that edit mode, you can click-drag over the beard vertices to select them. They'll turn orange when selected. Then right-click and Delete Vertices. You may have to do it again to catch some stragglers that were hidden from view.
Select the mage beard bones and delete them. Since you're already in Edit Mode, just right-click in the active view window and click Delete Selected Bones. Click again to confirm.
If you double-click on an "armature" in the Scene Collection panel, you should get a panel that lists armatures. Click the "X" to delete 002, which is not needed. This mod would probably still work, though, if you only deleted the beard vertices.
When finished, your blender hierarchy should look like it does in this screenshot:

10. Export FBX
Click File > Export > FBX. There's a lot to change here, so go by the settings in the screenshot. Save the exported FBX somewhere in your Rogue Legacy 2 Mods directory and make sure everything is named/organized clearly.

UNITY (LAST TIME)
Import the FBX you just exported from Blender and select it. In the Inspector panel to the right, check Convert Units--it should say "1cm (File) to 0.01m (Unity)"--and check Read/Write Enabled. Change "Optimize Mesh" to Nothing. (Disabling smoothing and optimization is probably not necessary. I just tried to avoid making unneeded changes. It may turn out the right way is the opposite of what I did.)
Drag the imported FBX into the Hierarchy panel and you should see, in the Scene panel to the left, that it lines up exactly with the original mesh. If you click the eyeball icon to the left of Player_model_AnimationSetA to hide it, you should see just the beard disappears and the mage hat remains. If the meshes don't line up, that means you've done something different from what I did and need to go back one or more steps.
Click File > Build Settings. In the Build Settings window, click the "Build" button in the bottom-right. Select your Rogue Legacy 2 Mods directory to save the build.
UABEA
Click File > Open and navigate to the Unity build you just created. In the _Data folder, select sharedassets0.assets. The Assets Info window should open automatically. If not, click Info to open it.
In the Assets Info window, you'll see a list of all assets inside the asset bundle. For this one, the list should be small enough you can just click on geoHeadgear_mage to select it. Since your Unity project contained both the original and your edited version, you should see it listed twice. Select the one with the smaller file size (fewer vertices since you deleted the beard). Click Export Dump and save it in your Rogue Legacy 2 Mods directory.
Now close the Assets Info window, click File > Open, and select the Rogue Legacy 2 "models" asset bundle. Open the Assets Info window. Click View > Go To Asset, enter Path ID 8847348790072101237 and click OK. This will take you straight to geoHeadgear_mage inside player_model_animationseta.fbx. There are actually seven FBX files containing geoHeadgear_mage, but it seems you only have to edit the one.
Click Import Dump and select the dump you just exported from your Unity project. Save. Click OK. Save again in the main window.
You can supposedly create mod packages in UABEA to simplify importing dumps, but I couldn't get it to work. If anybody can explain how to do that, it would making distributing mods easier.
AFTERWORD
Start the game and look at a mage to test. If everything was done correctly, it should look exactly the same only with no beard. The most common issue I ran into was giant hats because the scaling was off at some step.
When trying to do this in 3DS Max, when I didn't get giant hats, I kept getting deformed hats. I think this is because information was lost during export from Unity and/or import to 3DS. It may be worth trying again, using the more thorough Unity export method with AssetRipper. I was using AssetStudio at that point.
It may also be possible to use Maya. I haven't tried it. The devs used Maya, so I think it's likely to work.
0 comments