Encoding Mipmaps with Wiimms Image Tool
This tutorial shows how to add proper mipmaps on BRRES files modeled in SketchUp and created with CTools BRRES Editor.
Mipmaps will immensely improve the visuals of your track. Your textures will look smoother and you can heavily reduce moiré patterns.
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 for CTools tracks 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 - Preparing raw images
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 was encoded with CTools. If you created your OBJ with Sketchups 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 numer of mipmaps and the imageformat you want. For example a texture with 64x64 can have 3 mipmaps, 128x128 4 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. You can also use
--n-mm=auto
and wimgt will create as many mipmaps as possible.
If you want to encode all textures in a certain folder just use:
wimgt encode *.PNG --n-mm=5
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: [1]
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.
Main Tutorials
Introduction –
Textures –
Scale –
Modeling ⇒ Using Blender –
BRRES: CTools
BRRES: BrawlBox –
BRRES: RiiStudio –
Minimap –
Solidity –
KCL: Wiimms Tools –
KMP Editing
Object Editing –
Cameras –
Cannons –
Post-effects –
Videos
Battle Arenas
Battle Arenas –
Enemy routes in battle arenas ⇒ Using Wiimm's Tools –
Coins
Misc. Tutorials
Getting Files –
BrawlBox Tricks –
Animations –
Shadows –
Mipmaps
Custom Effects –
Moving Terrain –
Music –
Ports –
Paint Remakes –
Tutorial Archive
Extended presence flags: Track Tutorial –
LE-CODE Track FAQ
Testing and Reviewing
Testing a Track –
Visual Review –
Track Transformation –
Fixing Errors
Software
3D Tools –
BrawlBox –
CTools Pack –
KMP3D –
KMP Cloud –
KMP Modifier
Lorenzi's KMP Editor –
MagicY –
Material Tool –
Post-Effect Editor –
Wiimms SZS Tools –
Wiimm's Tool Manager
Other
KMP Objects –
Custom Objects –
Model Database –
Tutorial Archive