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