Difference between revisions of "Creating a BRRES with BrawlBox"

From Custom Mario Kart
Jump to navigation Jump to search
(Gonna update more later probably)
Line 2: Line 2:
  
 
== Introduction ==
 
== Introduction ==
This page describes how to create a [[Custom Track]] [[BRRES]] from scratch with [[BrawlBox]]. You will import the model from an exported DAE into [[MDL0]], import the textures into [[TEX0]] and edit some settings inside the MDL0 to make your model look right in-game. This page contains information that is useful even after your BRRES is created, even if it was made with another program.
+
This page describes how to create a [[Custom Track]] [[BRRES]] from scratch with [[BrawlBox]] and [[Brawlcrate]]. You will import the model from an exported DAE into [[MDL0]], import the textures into [[TEX0]] and edit some settings inside the MDL0 to make your model look right in-game. This page contains information that is useful even after your BRRES is created, even if it was made with another program.
  
 
== Importing the DAE File ==
 
== Importing the DAE File ==
Line 21: Line 21:
  
 
== Importing the Textures ==
 
== Importing the Textures ==
You can import the textures by right-clicking the root or using the Edit drop-down menu and selecting ''Import → Texture'' (or Folder; in this case, put all your textures on a folder and select it). Make sure you set the texture format to a format supported by Mario Kart Wii. The following formats are supported/recommended:
+
You can import the textures by right-clicking the root or using the Edit drop-down menu and selecting ''Import → Texture'' (or Folder; in this case, put all your textures on a folder and select it). Make sure you set the texture format to a format supported by Mario Kart Wii. When choosing texture format, it is recommended to follow chart below:
*I8
+
 
*IA8
+
[[File:Optimal-Texture-Formats.png|400px]]
*RGB5A3
+
 
*RGB565
+
You should use CMPR for most textures; textures with opacity (partially transparent) should be RGB5A3.
*CMPR
 
You should use CMPR for most textures; textures with opacity (partially transparent) should be RGB5A3. The CI4 and CI8 textures need their palette names in their respective material references.
 
  
 
The textures will be imported as TEX0 files inside the Textures(NW4R) folder in the BRRES. The references which point to them are located in the Materials section of the MDL0. If any textures are missing or referenced incorrectly, the game will crash. You can rename the textures and references to fix this if needed.
 
The textures will be imported as TEX0 files inside the Textures(NW4R) folder in the BRRES. The references which point to them are located in the Materials section of the MDL0. If any textures are missing or referenced incorrectly, the game will crash. You can rename the textures and references to fix this if needed.
Line 36: Line 34:
  
 
== Shaders ==
 
== Shaders ==
The default shader created by BrawlBox will work correctly in Mario Kart Wii. Navigate to the Shaders folder under the MDL0 to edit them; you might want to open Stage0 from Shader0, look for ColorScale and set it from "MultiplyBy4" to "MultiplyBy2" or "MultiplyBy1". This will set how bright your textures will be in-game. If you are not happy with any of the settings, you can experiment with the "Default Color" setting when importing the DAE.
+
The default shader created by BrawlBox will work correctly in Mario Kart Wii, however it is usually too bright. Navigate to the Shaders folder under the MDL0 to edit them; open Stage0 from Shader0, look for ColorScale and set it from "MultiplyBy4" to "MultiplyBy2" or "MultiplyBy1". This will set how bright your textures will be in-game. If you are not happy with any of the settings, you can experiment with the "Default Color" setting when importing the DAE.
  
 
== Materials ==
 
== Materials ==
Line 46: Line 44:
  
 
=== Materials for Textures With Transparency/Opacity ===
 
=== Materials for Textures With Transparency/Opacity ===
To enable opacity on a mesh/polygon, browse to the mesh's material. The settings should be the same as the materials for the normal textures, except for:<br>
+
To enable opacity on a mesh/polygon, browse to the mesh's material.
* XLU Material = True<br>
+
; If the texture does not have partial transparency/opacity, also set these settings:
* CompareBeforeTexture = False<br>
 
If the texture has partial transparency/opacity, also set these settings:
 
* EnableBlend = True<br>
 
* EnableDepthUpdate = False<br>
 
* CompareBeforeTexture = True<br>
 
If the texture does not have partial transparency/opacity, also set these settings:
 
 
* Ref0 = 128<br>
 
* Ref0 = 128<br>
 
* Comp0 = GreaterOrEqual<br>
 
* Comp0 = GreaterOrEqual<br>
 +
* Logic = And
 
* Ref1 = 255<br>
 
* Ref1 = 255<br>
 
* Comp1 = LessOrEqual<br>
 
* Comp1 = LessOrEqual<br>
 
+
; If the texture is translucent/has partial transparency, set following settings:
You also have to browse to the mesh under the "Objects" section in the MDL0 file and set the '''Draw Pass''' to '''XLU (Transparent)''' for each mesh/polygon. This should prevent the [[Harry Potter Effect]].
+
* EnableBlend = True<br>
 +
* EnableDepthUpdate = False<br>
 +
* XLU Material = True<br>
 +
* CompareBeforeTexture = True<br>
 +
You also have to browse to the mesh under the "Objects" section in the MDL0 file and set the '''Draw Pass''' to '''XLU (Transparent)''' for each mesh/polygon with partial transparency. This should prevent the [[Harry Potter Effect]].
 
You can also make a material (more) transparent by setting Constant Alpha Enabled = true and the Value to the value of transparency (0 = opaque, 255 = fully transparent). However, this setting doesn't ensure a model without the transparency settings above becoming transparent.
 
You can also make a material (more) transparent by setting Constant Alpha Enabled = true and the Value to the value of transparency (0 = opaque, 255 = fully transparent). However, this setting doesn't ensure a model without the transparency settings above becoming transparent.
  
=== Mipmaps ===
+
=== Texture Settings ===
Mipmaps are smaller versions of the textures, which are displayed when you are further away from the models, to improve the visuals of your track. Your textures will look smoother and you can heavily reduce [[moiré pattern]]s. For mipmaps to be displayed, you must navigate to the texture reference under each material and set the '''MinFilter''' option to '''Linear_Mipmap_Linear'''. The textures must actually contain mipmaps for this to work (explained above).
+
==== Texture Filtering ====
 +
Texture filtering describes how the specific texture is filtered. That can be changed using '''MagFilter''' setting.  
  
=== Culling ===
+
Most common option is '''Linear''' (bilinear sampling) that makes texture more blurry, which as a result makes the textures smoother. '''Nearest''' (point sampling) will make the texture look pixelated.<br>
The CullMode setting is set to "Cull_Inside" by default. This will make the "inside" of the models invisible and the outside visible, which is the usual setting. Setting it to Cull_Outside will make the opposite side of the model visible (the blue side in SketchUp) and setting it to Cull_None will make all sides of the model visible. This should be used for models which can naturally be seen from both sides, such as fences.
+
[[File:Mag-Filtering.PNG|400px]]
  
=== Materials and Shaders ===
+
==== Mipmaps ====
Materials have to be ordered by Shader references: Materials with reference to Shader1 should be UNDER Materials with reference to Shader0;<br>Schematically:
+
[[File:Moire-Pattern-Mipmapping.PNG|500px|thumb|Using mipmaps to eliminate moiré pattern]]
 +
Mipmaps are smaller versions of the textures, which are displayed when you are further away from the models, to improve the visuals of your track. Your textures will look smoother and you can heavily reduce [[moiré pattern]]s.<br> For mipmaps to be displayed, you can change the default '''MinFilter''' setting when importing using [[Brawlcrate]]. If not, you must navigate to the texture reference under each material and change the '''MinFilter''' option.<br>
 +
Most common setting is '''Linear_Mipmap_Linear''', however other settings are also possible, described below:<br>
 +
[[File:Texture-Filter-Modes.PNG|500px]]
  
*Materials:<br>
+
The textures must actually contain mipmaps for this to work (explained above).
MaterialA(Shader0)<br>
 
MaterialB(Shader1)<br>
 
  
*Shaders:<br>
+
===== LOD Bias =====
Shader0<br>
+
When using mipmaps, textures may become blurry if the texture LOD result is larger than expected and small mipmaps are referenced. To adjust this, you can change '''LOD Bias''' setting. Increasing the bias will make mipmaps appear closer, descresing will make them appear further away.<br>
Shader1<br>
+
[[File:LOD-Bias.PNG|400px]]<br>
  
This is because, for a strange and unknown reason, BrawlBox orders the Shaders by the Materials' references: so, if you have<br>
+
=== Culling ===
 
+
The CullMode setting is set to "Cull_Inside" by default. This will make the "inside" of the models invisible and the outside visible, which is the usual setting. Setting it to Cull_Outside will make the opposite side of the model visible (the blue side in SketchUp) and setting it to Cull_None will make all sides of the model visible. This should be used for models which can naturally be seen from both sides, such as fences.
*Materials:<br>
 
MaterialA(Shader1)<br>
 
MaterialB(Shader0)<br>
 
 
 
you will have, not apparently but in file level<br>
 
 
 
*Shaders:<br>
 
Shader1<br>
 
Shader0<br>
 
 
 
You have therefore to order your Materials by Shaders' references to avoid this problem.
 
  
 
== Next ==
 
== Next ==

Revision as of 16:47, 22 December 2022

This page is a part of the Custom Track Tutorial. Back to the main tutorial page.

Introduction

This page describes how to create a Custom Track BRRES from scratch with BrawlBox and Brawlcrate. You will import the model from an exported DAE into MDL0, import the textures into TEX0 and edit some settings inside the MDL0 to make your model look right in-game. This page contains information that is useful even after your BRRES is created, even if it was made with another program.

Importing the DAE File

To create a BRRES in BrawlBox, you need to import a DAE file, preferably in the 3ds Max format.

  • The default settings in the 3ds Max DAE exporter are usually correct.
  • If you are using SketchUp, the best option is to export the model as OBJ using the OBJ Exporter plugin, and import it in 3ds Max, then export as DAE. If you do not own 3DS Max, export the model from Sketchup as an OBJ and convert it to an FBX file with Autodesk FBX Converter 2013.3, then choose FBX 2013 as the Destination format, then convert that FBX to DAE.
  • If you are using Blender, export the model in FBX format. After you have your FBX file convert it to a DAE file with the tool above.

First make a new BRRES (File → New → Brres Resource Pack). Then right-click the BRRES node and click Import → Model. Use the following settings:

As of BrawlBox v0.77

The DAE will then be converted into an MDL0 file, which will be in the 3DModels(NW4R) folder inside the BRRES. If you're making the course model, make sure the MDL0's named "course". This applies to any other BRRES you might be replacing.

A ModelVersion different from 11 or other incorrect settings will make the game freeze. You might walk against some problems, most noticeably randomly moved faces/polygons and rotated models. This can be fixed by swapping the Axis Conversion setting when exporting the model, from Y-up to Z-up or vice versa. If that doesn't work instead try setting the pivots in 3ds Max. Set all pivots' positions to the origin (0,0,0) and rotate them -90 degrees on the X-axis.

If you have imported it, you might wish to rename things (such as meshes or materials) for more readability.

Importing the Textures

You can import the textures by right-clicking the root or using the Edit drop-down menu and selecting Import → Texture (or Folder; in this case, put all your textures on a folder and select it). Make sure you set the texture format to a format supported by Mario Kart Wii. When choosing texture format, it is recommended to follow chart below:

Optimal-Texture-Formats.png

You should use CMPR for most textures; textures with opacity (partially transparent) should be RGB5A3.

The textures will be imported as TEX0 files inside the Textures(NW4R) folder in the BRRES. The references which point to them are located in the Materials section of the MDL0. If any textures are missing or referenced incorrectly, the game will crash. You can rename the textures and references to fix this if needed.

You should set a number of mipmaps for each texture you import. Three is usually a good amount for normally sized textures. Large textures might use more and smaller ones might use less; you'll have to experiment with this. You will also need to make the Material use those mipmaps (see below). The mipmaps that BrawlBox creates are more suitable for Super Smash Bros. Brawl. If you want to use higher quality, more Nintendo-like mipmaps you should create your tex0 Textures with Wiimm's Image Tool. See: Creating Mipmaps with wimgt.

At this point, before editing shaders or materials, you should test your model in-game to see if it'll load (even if you haven't made the KCL or KMP yet).

Shaders

The default shader created by BrawlBox will work correctly in Mario Kart Wii, however it is usually too bright. Navigate to the Shaders folder under the MDL0 to edit them; open Stage0 from Shader0, look for ColorScale and set it from "MultiplyBy4" to "MultiplyBy2" or "MultiplyBy1". This will set how bright your textures will be in-game. If you are not happy with any of the settings, you can experiment with the "Default Color" setting when importing the DAE.

Materials

Material settings are very important to make your track look good. Note that messing too much with the material settings will most likely result in definitions which are incorrect or unsupported by Mario Kart Wii. Navigate to the Materials folder under the MDL0 to edit them. Some of it is explained here:

Materials for Normal Textures

The settings for textures without transparency (fully opaque textures) are almost completely right after importing. The only changes they require are for the light channels. Under SCN0 References you should have all set to -1 except FogSet, which should be 0. Also, make sure everything under "Z Mode" is set to True.

Material settings

Materials for Textures With Transparency/Opacity

To enable opacity on a mesh/polygon, browse to the mesh's material.

If the texture does not have partial transparency/opacity, also set these settings
  • Ref0 = 128
  • Comp0 = GreaterOrEqual
  • Logic = And
  • Ref1 = 255
  • Comp1 = LessOrEqual
If the texture is translucent/has partial transparency, set following settings
  • EnableBlend = True
  • EnableDepthUpdate = False
  • XLU Material = True
  • CompareBeforeTexture = True

You also have to browse to the mesh under the "Objects" section in the MDL0 file and set the Draw Pass to XLU (Transparent) for each mesh/polygon with partial transparency. This should prevent the Harry Potter Effect. You can also make a material (more) transparent by setting Constant Alpha Enabled = true and the Value to the value of transparency (0 = opaque, 255 = fully transparent). However, this setting doesn't ensure a model without the transparency settings above becoming transparent.

Texture Settings

Texture Filtering

Texture filtering describes how the specific texture is filtered. That can be changed using MagFilter setting.

Most common option is Linear (bilinear sampling) that makes texture more blurry, which as a result makes the textures smoother. Nearest (point sampling) will make the texture look pixelated.
Mag-Filtering.PNG

Mipmaps

Using mipmaps to eliminate moiré pattern

Mipmaps are smaller versions of the textures, which are displayed when you are further away from the models, to improve the visuals of your track. Your textures will look smoother and you can heavily reduce moiré patterns.
For mipmaps to be displayed, you can change the default MinFilter setting when importing using Brawlcrate. If not, you must navigate to the texture reference under each material and change the MinFilter option.
Most common setting is Linear_Mipmap_Linear, however other settings are also possible, described below:
Texture-Filter-Modes.PNG

The textures must actually contain mipmaps for this to work (explained above).

LOD Bias

When using mipmaps, textures may become blurry if the texture LOD result is larger than expected and small mipmaps are referenced. To adjust this, you can change LOD Bias setting. Increasing the bias will make mipmaps appear closer, descresing will make them appear further away.
LOD-Bias.PNG

Culling

The CullMode setting is set to "Cull_Inside" by default. This will make the "inside" of the models invisible and the outside visible, which is the usual setting. Setting it to Cull_Outside will make the opposite side of the model visible (the blue side in SketchUp) and setting it to Cull_None will make all sides of the model visible. This should be used for models which can naturally be seen from both sides, such as fences.

Next

It is a good idea to test the scale of your model as soon as possible, so follow the Solidity tutorial to make your track solid. You will also need to edit the KMP to put the start position over the track. You can see more stuff that can be done with BrawlBox in the BrawlBox Tricks page. Refer back to this tutorial as needed as you continue to refine your model.

Links