@Subsonic (Paul): I wouldn't rely on my script to handle material maps correctly at the moment. While it does get some things right, there are some underlying issues with Ishiiruka Tool command line that aren't present in the GUI. The script uses v0.9.10 if using the programs pack, which still handles converting materials to material maps correctly, but there is a bug in 1.0.0 that makes them the original size they were dumped with.
Speaking of all that, I've been updating the code to handle material maps in CTT-PS which leverages
Ishiiruka Tool to handle materials / material maps it finds in a pack. I've been testing Ishiiruka Tool 0.9.10 via command line and have found a number of issues. After that, I then realized there is a v1.0.0 of Ishiiruka Tool, so I updated to that, and found even more issues. So far I haven't even been testing with "emissive" textures (.lum), I figured there is enough issues already before trying to see what happens when those are thrown into the mix...
Global Issues:
• The
-usebc7 command doesn't do anything.
• The
-savecolor command seems to be acting as the
-useBC7 command.
• The color texture is always saved whether the
-savecolor flag is specified or not.
• There is no command line equivalent to
Scale X/Y settings. This isn't too big of a deal since that can be done manually and fed to dimensions (which currently don't work).
Materials to Material Map:
• Material Maps are created at the dumped resolution from Dolphin, not the actual resolution of the texture. This does not happen with
-frommaterial. Specifying width and height does not work around this, instead it
generates an error. I have a feeling this happened with the addition of the
Scale X/Y settings added to the GUI.
Material Map to Material Map (-frommaterial):
• BC7 Material Maps can not be converted to other formats (PNG, DDS-DXT5, etc). This
generates an error.
• The
-frommaterial command does not convert existing material maps to BC7 when using
-compress -usebc7 -savecolor (whether they be PNG or DDS-DXT5, -savecolor is used because it acts as -usebc7). This also
generates the same error as trying to specify the width and height.
Technical (DDS Header Issues):
• The DDPF_RGB flag is being set at
byte[80] a value of (40 hex) to say there is uncompressed data, but Ishiiruka textures are not uncompressed.
• The
dwCaps1 flags are not being set: DDSCAPS_TEXTURE, DDSCAPS_COMPLEX, and DDSCAPS_MIPMAP (when texture has mipmaps).
Long ago, I made
this image to help me understand DDS headers a bit better. The DDS header issues are not even really an issue since they still work with in Dolphin Ishiiruka, it just prevents the textures from being opened in other image programs + I can hotfix those on the fly. But some of the other issues are pretty severe, especially the commands not working correctly (-savecolor/-usebc7) and the scaling issue when creating from materials. Not being able to convert existing BC7 material maps to other formats isn't the end of the world, but this also means they can't be resized.
Edit: So.. all of this led me to trying to create my own material maps (again), and the one thing I'm hung up on is the normal map pixel values in the generated material map. When the
bump and
spec is converted to the
mat format, the pixel values are copied directly into the corresponding color channels. Easy enough, I could just directly import those into the red (spec) and blue (bump) channels respectively. But for the normal map X and Y values, the pixel values in the
norm texture do not match the values in the
mat texture. Some pixel values go up, some pixel values go down. I can't make sense of it, I'm not smart enough to understand what is happening here. Even if the values were "transformed" to a different range, they should all move in one direction, no? Does anyone know exactly what is going on here? Is there source code for the Ishiiruka Tool anywhere? Maybe that would help me to grasp what is going on.
Looking at the image above, it's obvious where the bump and spec values are coming from. What is not obvious, is how the normal map X and Y values are being calculated. There doesn't seem to be a consistency to how the new values are determined. Maybe some kind of filter is applied? Some formula that can either increase or decrease the value? Maybe the Z value from the normal map comes into play? This is really the only thing holding me up. While I have no problems using Ishiiruka Tool to create material maps, I can't really use it in its currently broken state. And I would like to be able to at least match what it is currently doing.