Hey guys. I'm working on some character customization in unreal3. Specifically, right now I'm trying to wrap my head around a good way to color shift my character's armor inside the material (think "dying" armor slots without losing the variation in tone). Ideally, I'd like to have a hue/saturation functionality but it seems slightly out of my realm! The blend modes provided are not ideal either, I think. Has anyone done anything similar to this?
I've been pampered by smarter people than I at previous companies and was wondering if anyone had any direction for me!
Thanks in advance nice guys!
Replies
Take your armor texture, now black out the bits you want to not colour change and save the result as a new image.
Take the first image again and do the opposite. Been a while since I used Photoshop but you can probably use a mask to split out the two cleanly. Greyscale it.
Put the greyscaled image into the alpha channel of the first, so it's all in one texture.
Make a 1D texture with the colours you want to be able to choose from, or a 2D one if it's hue/sat. Doesn't need to be big linear interpolation should sort it though watch your import settings.
In the material editor, take the alpha channel of your armour texture and multiply it by your palette texture. You can use a param as a UV input for this.
Add that to the RGB output of your armour texture.
-Take your Gloss Map and divide it up per RGBA solid color (EI: Metal is red, Blue is cloth, etc), you can have upto 4 colors, including the Alpha slot as masks.
-Import in UDK.
-Take each channel, and Multiply it by a Constant, this will allow you control the 'gloss' and roughness of a material in a very cheap and dynamic way if you wish.
*If you want it to be super cheap, don't change the constant into a Parameter.
-Now at this point, you should have imported your Diffuse too.
-Take each channel from your gloss map and mix it with your Diffuse.
*You can Multiply your channels by your diffuse, however, if the area you're mul by is dark color, the new 'dye' won't show up too well, the lighter the color is in the diffuse, the better. I suggest white, but it honestly depends on you.
*You can also Interpolate the color, use Lerp, and put in the mask in the Alpha and the, the Color in B and the Diffuse in A, however, in this way, any detail you have from the diffuse won't show up unless you do some clever masking, or put the detail on your gloss map.
-If you're doing a one color dye, then I suggest storing a mask in either your Diffuse/Spec, etc in the Alpha slot instead, the rest of the process is the same.
-Hue Saturation is this;
Constant Clamp Lerp (Desaturate Diffuse), (Diffuse), Constant x Mask if you wish, but you need a constant.
0 = Desaturate and anything negative is negative value, 1 = Diffuse as usual, 2 = Diffuse Saturate, etc, if you plan on going higher then 5, then remember to constant clamp the Lerp.
Have a look at this: https://dl.dropbox.com/u/778345/4stoofoo.upk
HSV values all effectively take 0-1 (or -1 to 1). So to hue shift from red to cyan, you'd stick 0.5 in the H slot. I set it to use 0-1 so it would be straightforward to control with a texture mask channel (in the example material I just used the texcoord node).
http://technical-eden.blogspot.ca/2012/01/gradient-mapping-awesome-way-to-get.html
I haven't used it in UDK but I can vouch for gradient mapping as a good way to tint textures - more control vs hue shifting a base color.
I was going to recommend that, but I still don't understand how the guy was able to isolate a single gradient strip and make it work without nasty seams in the end color.
He's clearly isolating the red-green strip, but what's the math behind it?