What you see above, two pixel goblins in loincloths, should have been very easy to make. I already had everything in place. It should have been no harder than importing a new texture. But what actually happened involved hours of searching Google, digging into forums, and exporting/importing the picture files every way I possibly could. You see, the picture above started off looking like this:
Notice how messed up their faces are? I realized that they only looked bad around the white that I drew in for their eyes and fangs. What I eventually figured out after many hours of frustration and eventually looking very closely at all of my imported textures is this: UDK doesn’t actually use the colors that I use in Photoshop. UDK does something unusual, presumably to save on the amount of memory it has to dedicate to texture colors. UDK divides up your textures into 4-pixel-by-4-pixel squares, and gives each square a local palette. When you import a texture that has big jumps in color from one pixel to the next, and you blow up that texture to get a pixelated look, then you can see the problems.
I had never noticed it before because all of my textures have had pretty close colors. All of my contrasting colors, say bright pink hair against black skin, were created using separate textures. The pink hair in its own texture never bled over onto the skin, which had its own texture. (And here, the loincloths are their own texture. That’s why the green isn’t bleeding over into the brown.) But now, when I tried importing a picture that had bright saturated green right next to black pupils and white … white scleras (I just looked that word up. I have a new vocabulary word now.) the problem seemed unavoidable.
If I couldn’t force UDK to use the picture file’s true color (and if any of you know how to do that, please let me know!) then I figured my only other choices were to use similar colors on every texture, and add every contrasting color as a new texture in my game materials, or I would have to blow up my picture files to 4x or 16x their original size to bypass UDK’s 4×4 pixel-color-approximator. Eventually, that’s what I ended up doing. The picture at the top of this entry was blown up from 1024×1024 to 2048×2048. That doesn’t give me pixel-perfect color, but it’s probably good enough for the distances we’ll use in the game.
So there, I guess I’ve found a workaround. I just wish that there were a way to tell UDK to use the picture file’s true color. It would have saved me hours of frustration. Oh well. Now I know. I guess spending a few hours to find a workaround to someone else’s game engine’s annoying optimizations is better than spending a few years building my own game engine that wouldn’t be anywhere near as good.