Basic Modding Tutorial - eArmada8/gust_stuff GitHub Wiki
Basic Modding Tutorial
Here is a basic modding tutorial for folks who want to get started modding characters in Atelier Ryza (and theoretically other Atelier games from Escha and Logy onward). Here we will do a basic mesh delete, mesh modification (partial delete in this case) and texture replacement. This tutorial does not have any major spoilers, and is basically safe for someone who has played at least part of Atelier Ryza.
Note that this is not a tutorial on how to use tools like Blender or Paint.NET. I will not be teaching basic universal skills - please refer to other tutorials like YouTube etc. I particularly recommend watching "3DMigoto Costume Mod Tutorial for Fairy Tail (PC)" by Ikaros; while it was made for 3DMigoto, I learned 90% of what I know from that video alone.
Basic Setup
- Install Python 3, if you don't have it already. (Microsoft store, I'm using python 3.9 but any version newer should work.)
- Install Blender (free!) in Steam. Optional: change to 4.2 LTS (right click Blender in steam, select Properties -> Betas -> 4.2 stable LTS).
- Install Paint.NET, which is free from the author's website. (If you would like to support the author monetarily, it is available for a fee from the Microsoft store.)
- Download DarkStarSword's plugin here (Right Click, Save As).
- Install the plugin (Blender -> Edit menu at top -> Preferences -> Add-ons -> Install).
- Download the G1M Exporter.
- Run the included "install_pyquaternion.bat" batch file, which will install all necessary python libraries to use the toolset.
- Download Gust Tools by VitaSmith.
Obtaining and unpacking a model
- First, let's get ourselves a model! I want to mod Ryza's default costume today, pc00a.
-
Put gust_pak.exe from Gust Tools into {Atelier Ryza folder}/data/ and drag PACK00_02.PAK (or whatever PAK file has the model you want) onto gust_pak.exe. This is will create a "data" folder ({Atelier Ryza folder}/Data/data/) and decompress the PAK into it. Move the contents of {Atelier Ryza folder}/Data/data/ into {Atelier Ryza folder}/Data/. Rename PACK00_02.PAK. Start the game, and make sure it loads properly.
-
The model we want is pc00a.elixir.gz (model) and pc00a.g1t (textures) in the {Atelier Ryza folder}/Data/x64/character/pc00a/ folder. Backup and copy the files to a working folder, with gust_elixir.exe and gust_g1t.exe. Drag pc00a_model.elixir.gz onto gust_elixir.exe (red arrow below), and pc00a_model.g1t onto gust_g1t.exe (blue arrow below). When they are done, you will have a new folder, pc00a_model, with the (partially) extracted model, which I will refer to as the work folder.
NOTE: Original g1t files have proper offsets and should unpack without issue using Gust Tools. However, attempting to open g1t files from some mods packed with older tools may result in a "File Size Mismatch" error. Use this script to repair the g1t file (Right click, Save As).
Inside the work folder, you will see 1. elixir.json, which Gust Tools uses to know what files to pack back into the .elixir.gz file, 2. g1t.json, which Gust Tools uses to know what files to pack back into the .g1t file. All the textures are this folder, as well as the model in G1M format.
- Put g1m_export_meshes.py, g1m_import_meshes.py, g1m_to_basic_gltf.py and lib_fmtibvb.py into the pc00a_model. Double-click g1m_export_meshes.py to unpack PC00A_MODEL_default.g1m which is the packed model file. PC00A_MODEL.g1m is the external skeleton.
NOTE: Instead I actually recommend running g1m_export_meshes.py from the command line. Press Win-R, type "cmd" and change directories to your work folder, then type:
python g1m_export_meshes.py
Python will not report any errors if the build script crashes when you double-click the script, and no one will be able to help you. Run from the command line for helpful error messages.
g1m_export_meshes.py will generate a new folder, PC00A_MODEL_default, with all the meshes and metadata. The metadata is in mesh_metadata.json.
Repacking the model
Before doing any mods, I am actually going to go through repacking the model. This is a good exercise to make sure you know how to get working .elixir.gz and .g1t files from your unpacked model. In addition, all subsequent mods below will refer back to this step.
- Make sure that g1m_import_meshes.py and lib_fmtibvb.py are in your work folder (see above). Double-click g1m_import_meshes.py and it will pack all the meshes back into PC00A_MODEL_default.g1m. NOTE: I recommend running
python g1m_import_meshes.py
from the command line.
Note that g1m_import_meshes.py only packed the original (untransformed) meshes; e.g. 0.vb, 1.vb, 2.vb and so on. There is currently no way to pack 0_transformed.vb, 1_transformed.vb, 2_transformed.vb and so on.
- If you have changed which g1m files you want packed into your .elixir.gz file, then update elixir.json with the correct filenames. It is unusual to need to edit this file.
If you have changed your textures, be sure to update g1t.json. Note that DDS headers are not stored in the .g1t file, and gust_g1t.exe does not read headers when packing .g1t. Instead it reads g1t.json. When saving your textures, either be sure to match the original, or update the .json. At least for the Windows D3D11 release, these are the codes for BC1, BC3 and BC7 textures (the most common):
0x59: BC1 (DXT1)
0x5b: BC3 (DXT5)
0x5f: BC7 (DXT10)
-
If the repack was successful, there should now be a new PC00A_MODEL_default.g1m in your folder, and the original file was renamed to PC00A_MODEL_default.g1m.bak.
-
Go up a folder, to the folder where you have pc00a.elixir.gz, pc00a.g1t, gust_elixir.exe and gust_g1t.exe. Drag the pc00a_model folder onto gust_elixir.exe to make a new pc00a_model.elixir.gz file, and drag the same folder onto gust_g1t.exe to make a new pc00a_model.g1t file.
- Copy those files back to {Atelier Ryza folder}/Data/x64/character/pc00a/ and load up your game to see your model.
Basic Mesh Delete
First, we will do a very simple mod - removing an entire submesh. Blender is not involved, but we will use it to preview what will happen.
-
Load Ryza's meshes into Blender. (File menu -> Import -> 3DMigoto raw buffers (.vb + .ib)) The meshes are in {Work Folder}/PC00A_MODEL_default/.
-
1.vb is a charm hanging from her leg pouch, we will delete that. For this mod we do not need Blender at all, except to identify the mesh.
NOTE in the screenshot that I am highlighting 1_transformed.vb. 1.vb is a cloth mesh, which means that it is auto-animated by the KT physics system that simulates gravity. We cannot edit these meshes but we can delete them. However, we will delete 1.vb, not 1_transformed.vb, since g1m_import_meshes.py ignores the transformed meshes.
A comparison of 0.vb and 0_transformed.vb. Only 0.vb is used by the game. The mesh cannot be changed, but it can be deleted.
- Go into {Work Folder}/meshes/ and delete 1.vb. (I recommend backing up your files first.)
- Repack and test your model. Congratulations on your first mod!
Basic Mesh Modification
This time I want to remove the medicine bottle Ryza's belt. This will not be as easy as removing the charm, since the bottle strap is part of the coat, pants and boots.
- Most of the bottle is 23.vb, and that can be deleted entirely. See the steps above. The top of the bottle and the strap hook are part of 10.vb. Select 10.vb, go into Edit Mode, select the parts of the belt you want to delete in Blender, and delete. (Again, this is not a Blender tutorial, although the basic steps are below. Please watch the video linked above or reference any Blender tutorial you like.)
Step by step: (Video tutorial here)
A. In the Topbar, go into the Layout workspace (tabs at top -> Layout), if you are not already there. Make sure you are in the 3D Viewport (Shift-F5). In the upper left you can see the current mode, which is likely Object Mode. If you are not in Object Mode, switch into Object Mode (from the drop down, or Ctrl-Tab)
B. In the Outliner, aka the box in the upper right with all the meshes and other objects, hide all the meshes except Ryza's coat/pants/strap (10.vb). Select each one and press H (or click the eye icon on the right). Select 10.vb. Ryza's coat/pants/strap should now be selected. Change Object Mode to Edit Mode with the upper left dropdown in the viewport.
C. Three icons will appear directly to the right of Edit Mode, which are Vertex Select, Edge Select and Face Select modes. Switch to Face Select mode.
D. Unselect everything (Select menu -> None, or Alt-A.)
E. With your cursor in the viewport (middle of the screen), hold down mouse wheel click (MWC) and move your mouse to pan and tilt the camera around the model. Hold down Shift-MWC and move your mouse to move shift the camera position (i.e. to strafe across the screen). Use Mouse wheel scroll (MWS) to zoom in and out.
F. Switch to Circle select (Select menu -> Circle Select, or press C). MWS to adjust the size of your "brush" for selecting polygons. Hold down the left mouse button (LMB) to select polygons. Hold down MWC to unselect polygons. Click the right mouse button (RMB) to leave circle select mode. You will need to do this to pan the camera.
G. Repeatedly do this until you have selected the polygons you plan to delete. Press C, MWS to adjust size, LMB to select some polygons, MWC to unselect ones you accidentally set, RMB to go back to camera mode, MWC/Shift-MWC to adjust the camera, press C again to select or unselect some more...
H. When you are done, delete those faces. (Mesh menu -> Delete -> Faces, or RMC in the viewport {when not in circle select} and select "Delete Faces") Want to do something else besides just delete? Try transforming! (Mesh menu -> Transform -> Move / Rotate / Scale, or one of the specialized tools like Push / Pull or Shrink / Fatten.) Just remember to consider how your changes will affect pose / animation.
-
Go back into Object Mode.
-
Export the mesh. File menu -> Export -> 3DMigoto raw buffers (.vb + .ib) Overwrite the original 10.vb. (Again, I recommend backing up your files first.)
-
Repack and test your model Congratulations on your second mod!
Basic Texture Replacement
This time I will change the color of Ryza's coat (which we determined from the last step is 10.vb).
- In the PC00A_MODEL_default folder, open mesh_metadata.json in a text editor such as Notepad. Going to the SUBMESH section, we can see that submesh 10 (the 11th section, which says
"id_referenceonly": 10
) uses material section 0 ("materialIndex": 0
)
- Go to the MATERIALS section. In the first entry,
"id_referenceonly": 0
, there are 4 textures listed, which are the texture map, highlights map, shadow map and normal map (types 1, 2, 5 and 3, respectively, pointing to 001.dds, 004.dds, 003.dds and 002.dds, respectively). We want to edit the type 1 map, which is listed as ID 0 ("id": 0
) - this is almost always 000.dds but let's find out for sure.
- Open g1t.json in your work folder, and find the first entry (which corresponds to ID 0, since JSON always numbers starting from 0). We can see it points to 000.dds, and the texture type expected is 0x5b or BC3 (DXT5) - see table above.
- Open 000.dds and make your changes. (Again, this is not a Paint.NET tutorial, but the basic steps are below.)
Step by step:
A. Open 000.dds in Paint.NET.
B. The texture is on a single layer, duplicate that layer (Ctrl-Shift-D). You will now have two identical images on top of each other. Select the upper layer, by clicking on it in the Layers window. If you do not see the Layers window, press F7. If you still cannot see it, press Ctrl-Shift-F7 to reset it to its default position in the lower right. (Video tutorial on using layers here.)
C. Select the yellow cape parts of the image. Press S to go into select mode, and to cycle between the four select modes (Rectangle select, lasso select, ellipse select and magic wand. Select part of the area that you want to start. Hold down the Ctrl key while selecting to add to your current selection, and the Alt key to subtract from your current selection.
D. Edit -> Invert selection (Ctrl-I), so that it is now selecting all the parts you do not want to change. Edit -> Erase selection (Press Del), so that all those parts are gone. Your image will not change, because those parts are still present on the lower layer! (You can see this in the layers window.)
E. Optional: I have more success doing recolor if I remove the existing color first. Adjustments menu -> Black and White (Ctrl-Shift-G). Even more optional but recommended: Duplicate this black and white layer a few times. You can try making a bunch of different colors, and then just drag the layers up and down and you will have variations to enjoy with minimal effort!
F. Switch to the Recolor Tool (Press R). Increase the brush size to something large, like 500. Increase the Tolerance to 100% (since we have already removed the areas we do not want recolored). In the Colors tool, select a new color. Drag-Click on the texture, and color the texture. (Note: Where you start will determine the color shift. So if your cursor is over a light area when you start, the entire recolor will be darker, and vice versa.) (Video tutorial on Recolor - This is worth a watch, it shows how to properly recolor and makes some of my steps above moot. But I like my method.)
Optional: Save as a pdn file before saving as a dds file. When you save as a dds file, it will need to flatten all your layers back into a single layer. If you have a pdn file, all the layers will be preserved, allowing you to keep making changes and variant textures.
-
Save the file in .dds format in the correct format - in this case, the game expects BC3 (DXT5). Alternatively, you can save in a different format, but update g1t.json so that the file is packed correctly.
-
Repack and test your model Congratulations on your third mod, you have made it to the end of the basic tutorial!