Help:Replacing models

Revision as of 06:54, 31 July 2019 by imported>Leoetlino (copyediting)

Model replacement is the process of changing the shape of an entity (weapon, character, etc) to a custom shape, either created by you or by someone else. Examples of model replacements include the Zelda and Linkle replacement mods.

This tutorial assumes you either have a model already, or will be editing one of the in-game models. It also assumes you will be replacing an in-game model, not making a new one. Pictures dealing with modeling programs are taken in 3ds Max, but similar options should be available in your program of choice.

Required Tools

Model replacement in Breath of the Wild requires a set of tools. These tools will vary somewhat, based upon your personal preference, but the tools below are currently the most effective for properly modding the game.

  • Switch Toolbox (Yes, even if you are using WiiU or Cemu)
  • A 3D modeling program of your choice (common choices are 3ds Max and Blender)
  • (optional) The CSV export script
  • (optional) If you are using 3ds Max, the BFRES importer MaxScript may be helpful. (expand the "Wii U & Nintendo Switch - BFRES importer (originally by ItsEasyActually)" to find it)
  • (optional) BotWUnpacker

Tutorial

Obtaining a Rig

 
The red box shows what to click to extract a model.

Summary: Export a model from the SBFRES you want to use, using Switch Toolbox. Take note of the skin count and the vertex buffers and formats.

A "rig" or "skeleton" is a set of "bones" that animations use. Every model is made up of several pieces: objects (which tells the game how to make the model in 3D), materials (which tell the game what the model should look like), and the rig (which tells the game how the model moves during animations). If you were to consider a door, the objects would be the rectangle for the main door and sphere of the knob, the materials would be the wood grain and brown coloring of the door and silver reflective surface of the knob, and the rig would be what tells the game that the knob rotates and the door swings inward.

In order to obtain a rig, you should find the SBFRES archive for the model you wish to use a rig from. Most models are contained in the game files in the content\Model folder. Once you've chosen your SBFRES, copy it to a safe place away from the game files, so you don't accidentally modify any of the original game's files.

Open Switch Toolbox, select File -> Open from the toolbar, and select your SBFRES. On the left side, expand the only available option, and then expand Models. Right-click on the model you need and select Export. If there are multiple options, pick as many as you need. For example, if you are replacing an entire armor set, you would export all three models, but if you were only replacing one piece of the armor, you would export just that piece. Export it as a DAE file. Switch Toolbox will ask if you want to export textures. It's not needed, but it doesn't hurt.

Next, expand the model(s) you are exporting, expand the Objects folder, and select each object in turn. On the right side of Switch Toolbox, you'll see a collapsed section labeled Vertex Buffer. Expand it. In this section, you will see several important things: the skin count, the vertex buffers, and the buffer formats. It's not important to know what all of these things mean if you don't wish, but take note of what they are for every object that you'll be replacing. Screenshots or a text file work well for saving this info. It will be important later.

Note: if you wish to export all the models in an SBFRES quickly, right-click on the Models folder instead and select Export All.

Import the Original to Your Workspace

 
Click on 1 to expand the menu, then click on 2 (or highlight 2 and click on 3) to import.

Summary: Import the DAE into a shared workspace with your model, so that the object list has your objects, the original objects, and the original skeleton.

Open your 3D modeling program of choice, and bring your replacement model into the workspace. Delete your model's skeleton from the object list, if it has one. Then, go to File -> Import, and import the DAE model you extracted. If you exported multiple models, only import the model you are currently working with. For example, if you exported an entire armor, you should only import the legs (as they are generally the simplest to do). Once you have finished the "Export Your Rigged Model" step, return here to repeat the process for other models.

You may get errors when you import - this is normal, you can ignore them.

In your object list, you will now see the original model's objects along with your objects. You will also see the original model's skeleton, which is important to have and you should generally not touch it.

Align Your Model With the Original

 
Select your model (1), select the mesh (2), select the type of thing to modify (3), and select how to modify it (4).

Summary: Get your objects to match up with the original ones, as close as possible. Anything delicate is important: feet, hands/fingers, waists, necklines, handles of weapons, etc.

In all likelihood, your model will differ greatly from the original you just imported. Using the Move, Rotate, and Scale tools, make sure your model lines up with the original's - the closer the better.

If your model has more objects than the original, delete unnecessary objects - for example, the torso and head, if you are modeling the legs right now - and combine necessary objects until you have the same number of objects.

If your model has fewer objects, do not worry, you'll be fine. Simply pick a few of the original objects to align with, and ignore the rest.

Rename your objects to something close to the original, so that you can easily figure out which of your objects corresponds to which original object. This will help both during this step and later, during the "Replace the Original Model with Yours" step.

Note: If you need help with this step, there are many great tutorials on YouTube.


Copy the Rig from the Original to Your Model

 
Select the original object (1), right click on the Skin modifier and copy it (2), select your replacement object (3), and right click in the modifier area and paste the Skin modifier there (4).

Summary: Copy the rig from the original object(s) to your object(s). Set maximum limit for bones to affect vertices to the object's skin count.

Select the original object's rig (called the Skin modifier in 3ds Max) in the modifier list, then copy it. Select your object, then paste the rig onto it. If all has gone well, you're done with this step. Most modeling programs use one or more of a series of algorithms to map the rig of one object onto the rig of another object automatically, and they're generally pretty good about it.

After pasting the rig onto an object, set the limit for the number of bones to affect each vertex to the original skin limit. In 3ds Max, you can do this by scrolling the modifier rollout on the right side down to the bottom, expanding Advanced Parameters, and setting the number in the Bone Affect Limit box. Other programs will have different ways of setting this limit.

If you get the model into the game and the animations deform the model in strange ways, you'll need to come back and manually adjust the rigging, which is a very time-consuming process, documented in a number of excellent tutorials on YouTube.



Delete the Original Model's Objects

 
The workspace has been cleared of the painted object, leaving only the custom, unpainted one and the skeleton.

Summary: Delete the original model's objects, leaving just your objects and the original skeleton. Rename your objects to the originals' names.

Delete all the objects from your workspace that you don't want to be imported to the game. This includes any secondary objects not part of your final model, your model's skeleton (but not the original model's skeleton), and the original model's objects.

It's also a good idea to rename the your objects to the names of the objects they're replacing. Though this isn't strictly necessary to get the replacement model to work, it can really help smooth things out later.




Export the Model from Your Modeling Program

 
Select the File menu (1), then click on export (2), or hover over it and click on Export (3).

Summary: Fairly simple, export your model. DAE is probably best.

Using File -> Export, export your model as whatever type you wish. Switch Toolbox, as of writing this guide, only handles DAE properly. However, it has options for FBX and OBJ as well, and as it receives updates regularly, FBX and OBJ may become properly handled at any time.

It also has an option for importing via CSV (which is not a model type) that is explained in the optional step, below.

Export the Model using CsvExportRewrite

Summary: In 3ds Max, use MAXScript -> Run Script... to run CsvExportRewrite.ms and save the model data as a CSV file.

Some people - the author included - have trouble with 3ds Max crashing when it tries to export models. For us, there is a MAXScript that exports the model as text, which Switch Toolbox can also use. In the toolbar use the MAXScript menu and select Run Script. Select the CsvExportRewrite script. A small box will pop up with a list of all the objects in your workspace. It has options to "Copy UVs" and "Explicit Normals" for each object. Copy UVs is disabled by default, and Explicit Normals is enabled by default. These settings should suffice, though if you end up with strange textures in game, try re-exporting with Copy UVs checked.

When you select export, 3ds Max will stop responding for a little bit as it exports, then it will respond again. When it responds, check the csv file it created. If it is empty, go through all of your objects, collapse or delete any modifiers that aren't the Skin modifier, select the Skin modifier for every object so that the modifiers background is dark grey (not blue), and then export again to a different file. It will fail again if you try to export to an empty file it has previously created, unless you've restarted 3ds Max since it created that file.

Import the Model Using Switch Toolbox

 
The list of import options Switch Toolbox displays.

Summary: Replace the original model in Switch Toolbox.

If you didn't leave Switch Toolbox open, reopen it now, and reopen the SBFRES you got the original model from. Right-click on the model that you want to replace, select Replace, and select the file you exported from your modeling program.

A dialog window of import options will appear. In the picture to the right, if the option does not appear in the box, then you should leave it as it is pictured.

Red box: Generally leave these unchecked. If your textures look all funky, try reimporting with Flip UVs. If you import and the model is not looking at you, but is instead face-down, reimport with Rotate -90 degrees checked. If you import and the model is face-up, use Rotate 90 degrees.

Green box: Check all the boxes corresponding to the buffer types that you took note of in the first step of this process, "Obtaining a Rig." If any object has one of those buffer types, check the box.

Yellow box: Select formats from the dropdowns that correspond to the formats you took note of in the first step of this process, "Obtaining a Rig." The UVs format will probably be Format_16_16_UNorm, which the dropdown may not have. If that's the case, Format_16_16_SNorm is fine.

Orange box: Keep Original Skin Count will be disabled by default in order to help avoid model stretching issues, but if you followed the Bone Affect Limit part of the "Copy the Rig from the Original to Your Model" step, then your skin count will be the same as the original, and you should check that box. Always check Map Original Materials. If you are importing from DAE (or FBX or OBJ if they are handled properly at the time you're reading this), then you should check Use Original Attributes and Use Original Attribute Formats.

Teal box: If you are importing from DAE (or FBX or OBJ if they are handled properly at the time you're reading this), then the left side will have the objects you are importing, and the right side will have the objects you are replacing. This will let you know whether or not Map Original Materials from the orange box will actually do anything, and is one of the reasons why you renamed your objects to the same name as the originals. The CSV import option does not support Map Original Materials at the time of writing, though it may do so in the future.

Once you've set all your import options, switch back to the Model Settings tab and hit Save.

Verify the Model Looks Good and Save

 
Verify that the model looks good in the viewer (2) and that the right material (3) is assigned to each object (1)

Summary: Check the model in the viewer for dropped weights, and check the material assignments. If it all looks good, save it.

Double check the model in the viewer to ensure that it has imported correctly. If it is face-down on its front or face-up on its back, reimport it. If pieces of the model are stretching to the "origin" (the center of the viewer space), then some vertices weren't properly weighted and you need to find them and re-rig them. If the model is wavy, where it should be straight, then you probably imported with 16 bit or 32 bit weights, and need to reimport with Blend Weights format Format_8_8_8_8_UNorm.

Also verify that the material assigned is the correct one. If you imported from a CSV file, these will almost certainly be wrong. This step is another reason we renamed the objects to the original names: the original names have the material name at the end, so there isn't confusion as to what object owns what material. A single material may be assigned to multiple objects, but any object may only have a single material.

Lastly, verify that the vertex buffers list for each object contains all of the same entries as the original object did (you should still have the list from the beginning of this process). If any buffers are missing, reimport the model and check the boxes for those buffers. If they are still missing, your model format does not contain that information (OBJ) and you should use a different format. If there are buffers that the original object did not have, select them and click Remove, then click Yes when it asks if you're sure.

Once all that is done, you're all set. Hit save. Your SBFRES now has your custom model and is ready to be loaded into the game!

Troubleshooting