THIS WILL NOT WORK FOR THE UNOFFICIAL PATCH. USE THE LATEST NZP REBOOT PSP VERSION
Clut4 textures have a 4 bit color palette. They have a max of 16 different colors. Instead of loading a variety of colors for many different parts of a texture, our load times decrease and we consume less memory.
For starters, we're going to import our textures into GIMP after exporting them through Wally. A gimp plugin will be required. If you are converting a pre-built map's textures (for maps that you no longer have sources for), then you can export bitmaps using the BSP Viewer application.
Upon first glance, it may seem as though Clut4 does not support images with an alpha component. However, this is not true. Clut4's limitations are:
- 16 colors
- MINIMUM of 32 x 32 texture
- Size must be a power of 2
Let's get started. I'll be using the railing texture for NDU:
From here, we're going to need to scale our colors down from 256 to 16. To do this, we will be importing it into GIMP and changing the RGB index from 256 to 16. This is done by going to the Image -> Mode -> RGB and then switching back to index, which will give you the prompt for color depth. Enter 16.
Depending on the number of colors your image has, it may look much different with color reduction. Fortunately for this image, it does not.
Something this image requires is for it to be scaled or cut off in order to get the size of the image to be a power of two. Since our width is 80, we need to reduce it by 16. You can do this by either scaling the image (not a good idea) or by cutting our areas that don't need as much room (for instance, the width of the left portion of the image can be cut into some pieces and put together again while making it appear close to the same. Ideally, this should be done BEFORE using it in your textures for the map to ensure it fits appropriately.
For now, the image looks good in terms of how we want it to look. What is important now is to mask the alpha portion of this image. What should be done is to color in the image's alpha portions with a magenta color of hex 0xff00ff. This will allow us to identify it easier when exporting later.
NOTE: You may need to switch back to RGB and then to indexed after changing your alpha portion to magenta, since coloring something in will add one extra color (which won't work if you already have 16 colors).
Now we're ready to export the image. We're going to export it as a .raw format (make sure the plugin is installed!!!). Use these options:
This step requires hex editing in order to change our alpha color to a truly alpha mask. In order to do this, we need HxD.
Open the .rawpal file in HxD and find a location which has 8 bytes that have the value 0xff00ffff. The first three are for color data followed by the alpha value! We're going to change all of these values to 0x00000000
After:
From here, we're going to need to use the convert_all.py script written (from what I believe) by Shpuld. If you've downloaded the NZP Reboot then you already have this (and many practice raw images) available. This is located in the psp/nzportable/nzp/textures/r4w folder.
Paste your .raw, .rawpal, and .h file in this directory and run convert_all.py from the command line. If everything works, then your "out" folder in this directory should contain your .r4w image.
TO USE THIS TEXTURE put it in nzp/textures/maps/<MAPNAME>. If everything goes well, then your texture will be loaded when you load your map.
To ensure this tutorial worked, and to make sure anyone who gets a problem like this, I've left out the alpha component of the texture:
After fixing alpha:
If you cannot get your texture to load as clut4, feel free to comment below. If you absolutely just cannot get anything to work, you can always just include the texture in the wad and have it load as wad3. This happens already for sky textures and trigger textures:
Enjoy.
Clut4 textures have a 4 bit color palette. They have a max of 16 different colors. Instead of loading a variety of colors for many different parts of a texture, our load times decrease and we consume less memory.
For starters, we're going to import our textures into GIMP after exporting them through Wally. A gimp plugin will be required. If you are converting a pre-built map's textures (for maps that you no longer have sources for), then you can export bitmaps using the BSP Viewer application.
Upon first glance, it may seem as though Clut4 does not support images with an alpha component. However, this is not true. Clut4's limitations are:
- 16 colors
- MINIMUM of 32 x 32 texture
- Size must be a power of 2
Let's get started. I'll be using the railing texture for NDU:
From here, we're going to need to scale our colors down from 256 to 16. To do this, we will be importing it into GIMP and changing the RGB index from 256 to 16. This is done by going to the Image -> Mode -> RGB and then switching back to index, which will give you the prompt for color depth. Enter 16.
Depending on the number of colors your image has, it may look much different with color reduction. Fortunately for this image, it does not.
Something this image requires is for it to be scaled or cut off in order to get the size of the image to be a power of two. Since our width is 80, we need to reduce it by 16. You can do this by either scaling the image (not a good idea) or by cutting our areas that don't need as much room (for instance, the width of the left portion of the image can be cut into some pieces and put together again while making it appear close to the same. Ideally, this should be done BEFORE using it in your textures for the map to ensure it fits appropriately.
For now, the image looks good in terms of how we want it to look. What is important now is to mask the alpha portion of this image. What should be done is to color in the image's alpha portions with a magenta color of hex 0xff00ff. This will allow us to identify it easier when exporting later.
NOTE: You may need to switch back to RGB and then to indexed after changing your alpha portion to magenta, since coloring something in will add one extra color (which won't work if you already have 16 colors).
Now we're ready to export the image. We're going to export it as a .raw format (make sure the plugin is installed!!!). Use these options:
This step requires hex editing in order to change our alpha color to a truly alpha mask. In order to do this, we need HxD.
Open the .rawpal file in HxD and find a location which has 8 bytes that have the value 0xff00ffff. The first three are for color data followed by the alpha value! We're going to change all of these values to 0x00000000
After:
From here, we're going to need to use the convert_all.py script written (from what I believe) by Shpuld. If you've downloaded the NZP Reboot then you already have this (and many practice raw images) available. This is located in the psp/nzportable/nzp/textures/r4w folder.
Paste your .raw, .rawpal, and .h file in this directory and run convert_all.py from the command line. If everything works, then your "out" folder in this directory should contain your .r4w image.
TO USE THIS TEXTURE put it in nzp/textures/maps/<MAPNAME>. If everything goes well, then your texture will be loaded when you load your map.
To ensure this tutorial worked, and to make sure anyone who gets a problem like this, I've left out the alpha component of the texture:
After fixing alpha:
If you cannot get your texture to load as clut4, feel free to comment below. If you absolutely just cannot get anything to work, you can always just include the texture in the wad and have it load as wad3. This happens already for sky textures and trigger textures:
Enjoy.