Difference between revisions of "Encoding Mipmaps with Wiimms Image Tool"

From Custom Mario Kart
Jump to navigation Jump to search
(Created page with "{{subst:Custom-Track}}")
 
Line 1: Line 1:
  
[[Category:Delete]] <!-- To test your competence, delete this complete line (Category:Delete). -->
+
{{under-construction}}
 +
 
  
<!-- Below is the info box for your track. Remember to read and delete comments such as these as you progress through the page. -->
 
<div class="float-right">
 
{{Misc-Info
 
|name= {{PAGENAME}} <!-- this automatically takes the page's name and makes it the title of the info box. -->
 
|creator= <!-- Track Maker's name -->
 
|designer= <!-- the person or group who originated the idea or layout for the level -->
 
|type= <!-- Custom, Remake, or Ported and/or Style or Environment -->
 
|version= <!-- v1.0, Beta, etc. -->
 
|date of release= <!-- List the date of the LATEST version of the track. Use YYYY-MM-DD format. -->
 
|editors used= <!-- programs like SketchUp, Blender, Photoshop, SZS Modifier, CTools, KMP Modifier, etc. -->
 
|difficulty= <!-- x/10 -->
 
|download 1= <!-- Paste the full URL for the download link or leave it empty if you don't have one. -->
 
}}
 
<!-- Leave a space behind all equal signs ( = ) to avoid problems formatting problems.  Likewise, don't put dashes ( - ) into any field.  The names of each field (|download 1, etc.) must not be changed, or you'll have errors on the page. -->
 
</div>
 
  
 
==Overview==
 
==Overview==
<!-- Describe the track here. Use the SHOW PREVIEW button as you edit the page, SAVE only when you're sure the page is correct. -->
+
This tutorial shows how to add propper mipmaps on brres files modelled in Sketchup and created with CTools Brres Editor.
<!-- WARNING: It is against wiki rules to edit any page more than 2 times in a 15 minute period. -->
+
 
 +
Mipmaps will immensely improve the visuals of your track. Your textures will look smoother and you can heavily reduce moiree patterns.
 +
 
 +
The problem with mipmaps on brres files created with CTools is that in [[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 reencoded with BrawlBox the mipmaps will be of poor quality.
 +
 
 +
To create proper mipmaps for CTools tracks you have to use Wiimms Image Tool wimgt, 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]]).<BR>'''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
  
==Media==
+
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--“.
<!-- Pictures and videos go here. You may upload an image of the track. Use JPG format, and keep it under 200kb in size. Make sure to give the image a long, descriptive name, otherwise a moderator will delete it.
 
  
For a single image, use this format:
+
==Step 3 – Preparing raw images==
[[File:MyCustomTrackImage|400px|thumb|none|Description]]
 
400px is the same width as a youtube video. Do not make it larger.
 
  
Use the following format for multiple 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. <br>
<gallery>
+
Example: Rename your texture named "texturename.PNG" to "filename-SKP--texturename.PNG". <br>
File:MyCustomTrackImage| Description
+
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...
File:MyCustomTrackImage2
 
</gallery>  
 
  
Here's the video format:
+
==Step 4 - Encoding TEX0==
{{youtube-box||youtube_id|Title}}
 
The Title should be the version number (BETA 1, v1.0, etc.)  Don't add the name of the person who uploaded the video.  Do not put more than 3 videos on this page. -->
 
  
==Version History==
+
Next you will encode your PNGs to TEX0 with mipmaps using the following command:<br> wimgt encode filename.PNG --n-mm=5 <br>
<!-- Add info about changes to the level here.
+
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. <br> If you want to encode all textures in a certain folder just use: <br>wimgt encode *.PNG --n-mm=5
This is a table for your track's version history. Put in the date you released each version of your level, and what changes you made in each version.
+
<br>
{| class="wikitable"
+
'''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:<br>wimgt encode filename.PNG --transform=CMPR --n-mm=5<br>
|-
+
The option --transform can encode in every known imageformat. For a list of all options for wimgt look here: [http://szs.wiimm.de/wimgt/ wimgt]
! align=left| Version
 
! align=left| Date of release
 
! align=left| Information
 
|-
 
| v1.0
 
| 2012-04-27
 
| Some info about an old version. You could add a DL link to the old one here.
 
|-
 
| v1.1
 
| 2012-12-25
 
| Some info about the current or upcoming version.
 
|}
 
-->
 
  
==Custom Track Distributions==
+
==Step 5 - Replacing your TEX0==
This track is part of the following [[Custom Track Distribution]]s:
 
<!-- please insert distributions in alphabetic order -->
 
* (none)
 
  
<!-- You can list all of the other levels, characters, etc. you've made in your user link, change the XXX to your name and use User-XXX-Link as a guide.  Add it to http://wiki.tockdom.com/wiki/Author_Reference when you're done setting it up.
+
- All you need to do now is replacing your old TEX0 from your Textures(NW4R) folder with the TEX0 you just created with wimgt.
{{User-XXX-Link}}
+
- After that repack the brres using:<br>wszst create course_model.brres.d -o <br>and rename the file correctly if needed. <br>
-->
+
'''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 reencode the TEX0.
[[Category:Track/Custom]]
 

Revision as of 15:25, 3 February 2016

Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.


Overview

This tutorial shows how to add propper mipmaps on brres files modelled 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 moiree patterns.

The problem with mipmaps on brres files created with CTools is that in 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 reencoded with BrawlBox the mipmaps will be of poor quality.

To create proper mipmaps for CTools tracks you have to use Wiimms Image Tool wimgt, 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).
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 imageformat. For a list of all options for wimgt look here: wimgt

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 reencode the TEX0.