Importing Custom Models

Tools and requirements

 * An extracted dump of the game.
 * You can go here to learn how to dump the game, and here to learn how to extract the files from your dump.


 * The model you want to import, its textures, animations, etc.
 * A tool you can use for importing/exporting 3D models (3ds Max is recommended. Blender is more accessible, but only works with the latest versions of BrawlCrate. BrawlBox does not support Blender.
 * A blank .arc file with the "g3d" folder. You can make one yourself simply by taking an existing .arc from the game's Object folder and deleting all .brres files, or by downloading this empty one here. Afterwards, you can import an existing .brres, or create a new one by right-clicking the folder and selecting New -> BRRES.

Process
todo:

- importing (converting with 3ds Max or fbx converter)

- fixing materials and shaders

Importing - Models
First you'll need a .dae file of the model that you want to import. You can either export using 3ds Max, or use FBX Converter to convert a model file into .dae.

Now, to get started on importing models, right-click on your brand new .brres and select Import -> Models. Then, select your .dae.

(todo: add something about settings and what they do; if you're reading this you can go ahead and enable Add Colors and Blender Bone Fix. They'll probably be useful.)

To add textures, right-click on your .brres and select Import -> Textures.

Importing - CHR0 Animations
You'll need a .anim file for your animations. (todo: add a guide)

Now we want to import our animations. Right-click on the .brres and select Import -> Model Animations, and import your .anim file. If you can't view the animations with BrawlCrate (which can happen), try to view it with BrawlBox instead.

Materials
To create a material for the model, open the .mdl0 and go to the "Materials" folder. (If it doesn't exist, then right-click on the mdl0 and select New -> Material. It will generate a material and shader.) Right-click it, and select Add New Reference. Rename the material as necessary.

Once you've added your new reference, a new reference called "NewRef" will appear (this will also appear in the "Textures" folder of the mdl0). Rename it to the name of the texture that you want to reference. Afterwards, you can go to the "Textures" folder of the mdl0 and delete the "NewRef" texture reference, as it isn't needed anymore.

Shaders
Look for an existing object in the game's "Object" folder. Find the "lm_0XY" (where X is the identification number for the lightmap texture in its group, and Y is/are the identification letter(s) for the lightmap texture usage.). A chart of what these stand for can be seen below. Once you've found them, export them as .tex. Then import them into your model..

Go back to the file you exported the lightmaps from. Export the materials which use the lightmap. In the material you can see the shader that it uses. Export the shader as well (found in the "Shaders" folder in the mdl0).

Now go to your model, and replace the existing material and shader with the ones exported. For the material, be sure to rename the first ref to the actual texture of your model, since by now it's the name of the texture from the model we exported it from. Add any other references necessary. Be sure to rename the material itself if necessary.

Lastly, we open the "Objects" folder of the mdl0 and click on the object that uses the material that we just imported.

Set TextureMatrix[1 & 2]Enabled to true. This way the lightmap textures are properly used. You can also refer to this side for another tutorial made for MKW, though be aware that there might be differences between MKW and NSMBW model importing processes!

Rigging
Often you have a model but it isn't rigged to bones. This means you can't animate it which basically makes it unusable in a game. Below are two tutorials, one for 3ds Max and one for Blender:

3ds Max

Blender

Transparent textures
Refer to this side to see how to setup the materials for transparency!

Setting up the lightmaps in the code
In Newer we got functions called. These have to be called in order to get your model to display correctly with applied lightmaps. Which one to call depends on the lightmap textures your model uses. E.g. if it has  and   for example, you will have to call.

Loading a model
The above code loads the Cheep Cheep model from the original game. For a list of the models in the game see here.

Notice, that the bitmask passed to  controls which parts of the model are copied. Most of the time you will see  in Newer but for example for pat0 animations to only apply to one actor or sprite at a time and not all of them that are spawned somewhere, you have to bitwise or the bitfield with 0x3, so each time to object is spawned, a new copy of the animation is created that will only affect the newly spawned object and not the previous ones. Below a list of flags for different animation types: And that's why above you see  instead as the code was written with the intention to use a pat0 animation. So:.

CHR0 Animations
After adding above to your class definition you have to get an animation and set it up. This happens in line 7 of the second code block of "Loading a model": Usually for chr0 animations we define a function like the one below so we only need to call that one function whenever we want to change to another animation: This function you also call at the end of your  function next: Just call this functions with changed parameters whenever you want to switch to another chr0 animation from here on. Lastly you have to make sure the contents of the functions above is in your code so the model gets updated correctly and the animation loops (lines 19-21).

PAT0 animations
Again you have to put above in your class definition. Then you add this at line 7 of the second code block of "Loading a model" to load the pat0 animation. Lastly you can define yourself a simple function which switches the texture according to the entries in your pat0 animation.

SRT0 animations
Above needs to be added in the class definition. Above has to be at line 7 of the second code block of "Loading a model". Lastly you need to process the srt0 animation each frame so you likely want to put above in your.

VIS0 animations
to be added

CLR0 animations
to be added

SHP0 animations
to be added

Introduction
This tutorial will show you how to import custom models over vanilla models in NSMBW. Certain examples this guide will apply for are things like enemies, player models, etc. This does not cover replacing background models, for that see the Custom Backgrounds tutorial. '''DISCLAIMER: This guide will mainly be using Blender as it is the most accessible due to it being freely available. You should also have basic knowledge about Blender in general before diving into this tutorial.''' Let’s get started!

Tools and Requirements

 * You own extracted dump of the game’s files


 * The model you want to replace. See List of Object Files to find the models you want to replace.
 * BrawlCrate (used over BrawlBox since it tends to be better with Blender exported models)
 * Blender (version 3 will be used in this guide, but versions such as 2.9 will work as well)
 * Autodesk FBX Converter for converting the models from FBX <-> DAE and some other formats.
 * The model(s) you will be importing plus its textures. Can be either made from scratch, from this game or another, etc.

General model tips
The models you import I would personally recommend generally being around the same polygon count or less than the original models. You can go over the amount, but you shouldn’t be too crazy with the polygon count since this is a Wii game after all, and it could cause lag in-game with too many of said model on-screen.

Exporting models as a base
In BrawlCrate, open the .arc file that has the models you want to replace. For this example, I am going to be replacing the Climbing Chain Link Koopa model with the Dry Bones model from Mario Kart Wii. So for this I open nokonokoB.arc in the Object folder. Then open the brres file in the g3d folder, then navigate to the MDL0 that is the model you will be replacing, found in the 3DModels(NW4R) folder.

Right click the appropiate MDL0, select Export, and save the model as a .dae file wherever you can find it.





Next you want to export the materials and shaders to use later on.

Expand the "Materials" tab, and right click each material and export the same way you exported the shaders, and save it wherever you can find it. Then, expand the "Shaders" tab and export the shaders the same way you exported the materials in the previous step.



Importing into Blender
TO BE WRITTEN