The Dashing Strike Image Processor for Games is a utility that can fix bad alpha channels (those that cause problems when used with GPU texture filtering) in PNG images files exported from tools like Photoshop, assist in debugging raw texture data, and generate single- and dual-color tint maps.
Usage is simple - download the executable and then drag and drop any PNG file onto it. The executable is the entire program, no installation necessary.
Photoshop has an alpha problem. Specifically, it's really hard to deal with modifying the alpha channel in Photoshop, and, additionally, when you export an image from Photoshop as a PNG, and the alpha for a given pixel is 0, it uses seemingly arbitrary colors for the RGB components of those pixels. This is a big problem for games (which use GPU hardware texture filtering) for two reasons:
As an example, consider a texture that is just 2 pixels, one that is opaque black, and the other of which is invisible but, for whatever reason, Photoshop decided to export with magenta in the RGB channel (which is surprisingly common, though usually it seems to use colors from invisible or hidden or previously deleted layers, or black or white).
As you can see, when this texture is minified or magnified, some of that magenta ends up on the screen, where the blended alpha values are not invisible and the color is blended with the magenta. Ideally, those blended pixels would be getting solid black at 50% opacity instead.
For another example, here's a texture from a PSD I made just now, overlaying an image grabbed from here on top of some colors, and then exporting as a PNG. You'll find the RGB values for the pixels with alpha=0 is madness, if you inspect the RGB channels of the PNG - there's a convoluted way to pull it back into Photoshop and view this with Layer Mask from Transparency and then deleting the mask, but the easiest way is to drop it on ImageProcessor, set it to View mode at the top, and toggle the Alpha: setting to Ignore.
|Source image:||RGB data only:|
(looks identical when
|RGB data only:|
Conclusion: When you've got weird halos showing up around your textures, run it through the PS Alpha Fix mode, and you'll be golden!
ImageProcessor can generate a set of masks for optimal 2-color tinting. Given a source image which has two primary colors used on the parts of the image that are desired to be tinted, it will generate a base texture (where the tinted areas are grayscale) and a 2-channel tint mask directing which color should be applied using a simple run-time dual color tint operation (e.g. in a pixel shader) equivalent to
float value = dot(tex0.rgb, vec3(0.2, 0.5, 0.3)); output = mix(mix(tex0.rgb, value * color2, tex1.g), value * color1, tex1.r);
Note: ImageProcessor can also register itself into your right-click menu in Explorer for PNG files, but on newer versions of Windows, depending on what other image tools and programs you have installed, this may or may not work reliably, so the drag and drop method is recommended.