Encoding Mipmaps with Wiimms Image Tool
This tutorial shows how to add proper mipmaps on BRRES files using Wiimm's Image Tool.
Mipmaps will immensely improve the visuals of your track. Your textures will look smoother and you can heavily reduce moiré patterns.
In case you used CTools for Brres Creating: The problem with mipmaps on BRRES files created with CTools is that in the TEX0 Header offset 0x14 is always 0, so there will be no mipmaps shown in game even though CTools created them and mipmaps were enabled with BrawlBox. Even if textures are encoded with BrawlBox the mipmaps will be of poor quality.
To create proper mipmaps, you have to use Wiimms Image Tool, which is part of Wiimms SZS Tools. You will also need BrawlBox to enable the use of mipmaps.
Step 1 - Enable Mipmaps
Enable mipmaps with BrawlBox by setting MinFilter to Linear_Mipmap_Linear in your materials references (see BrawlBox Tricks, if you have problems opening your CTools BRRES go to that tutorial too, to make your BRRES compatible with BrawlBox).
Note: You can do all your BrawlBox stuff like culling, animations, shaders etc. first and after that continue with step 2.
Step 2 - Extract your BRRES
Now extract your BRRES with wszst with the command:
wszst x course_model.brres
Open up the extracted folder and go to Textures(NW4R) and look at the name of your Textures. For SketchUp tracks, they will most likely be named something like "filename-SKP--texturename." Copy the prefix "filename-SKP--".
Step 3 (optional) - Preparing raw images of Sketchup textures
For best quality results it is highly recommended to use your raw image files (the .PNG files of your SketchUp OBJ model) and not the images that were encoded with CTools. If you created your OBJ with SketchUp's OBJ Exporter they will be stored in a folder called "trackname_Textures". Now rename all textures you want mipmaps for with the prefix you copied from Textures(NW4R) folder of the BRRES, so the PNGs are named exactly like the TEX0 in your brres.
Example: Rename your texture named "texturename.PNG" to "filename-SKP--texturename.PNG".
You can optionally sort those PNG in different folders, depending on the number of mipmaps and the image format you want. For example, a texture with 64x64 pixels can have 2 mipmaps, 128x128 3 mipmaps, etc.
Step 4 - Encoding TEX0
Next you will encode your PNGs to TEX0 with mipmaps using the following command:
wimgt encode filename.PNG --n-mm=5
This command will create a TEX0 of the texture filename.PNG with 5 mipmaps (Note: In BrawlBox this would be "Level of Detail: 6"). You can also use
and wimgt will create mipmaps till the texture reaches 16 pixels in either one or both dimensions. Be aware that mipmaps with a size of 16x16 or smaller looked completly blured out on TV. If you want to set another minimal size you can add:
This will set the minimal mipmap size to 32 pixels.
If you want to encode all textures in a certain folder (in this example with automatic creation of so many mipmaps till a mipmap size of 32px is reached) just use:
wimgt encode *.PNG --n-mm=auto --mm-size=32
NOTE: CTools normally encodes your TEX0 as CMPR but wimgt will encode your TEX0 as RGB5A3 by default. The quality of your textures will be a lot higher but it will blow up the size of your BRRES. So it is recommended to only use RGB5A3 on textures that really need it. To force wimgt to encode as CMPR use the command:
wimgt encode filename.PNG --transform=CMPR --n-mm=5
The option --transform can encode in every known image format. For a list of all options for wimgt look here.
Step 5 - Replacing your TEX0
All you need to do now is replacing your old TEX0 from your Textures(NW4R) folder with the TEX0 you just created with wimgt.
After that repack the BRRES using:
wszst create course_model.brres.d -o
and rename the file correctly if needed.
NOTE: If you want different textures appear in-game depending on how far the texture is away, you can decode your new TEX0 files with:
wimgt decode texturename
Now edit the PNGs of the mipmaps and rencode the TEX0.
Introduction – Textures – Scale – Modeling – BRRES: CTools – BRRES: BrawlBox
Minimap – Solidity – KCL: Wiimms Tools – KMP Editing – Object Editing
Cameras – Cannons – Post-effects – Videos