Download

Selecting NON-RGB colors in a Color ID mask for material blending

So I have a asset with more than 4 materials on it, I am curious how to select the colors that are not R,G,B, or the Alpha for blending.

So lets say I have a Red, Orange, Yellow, Green, Teal, Blue, etc. How would I select the Orange, Green, Teal for a material blend?

I searched around and I found this thread on Polycount but no-one went into the detail on how they got more than 4 materials to blend.
http://www.polycount.com/forum/showthread.php?t=99335&page=32

I figure I can just create 2 seperate color ID masks, but that’d be a waste of texture space.

Bump , very useful . Someone did it work?

If you’re looking for on/off (no alpha blending), then you can have 256 materials just by using each RGB value for a different material.

If you want to blend them, then you’re out of luck because Cyan is a mix of the Green and Blue channels from RGB, and there’s no way to tell whether you meant to mix the G and B textures, or if you wanted the Cyan texture… And even then, no way to tell what you wanted to blend the Cyan texture with.

Wouldn’t you be able to take the specific blend mask of the G and the blend mask of the G and blend them using the “add” node?

Well, technically there’s a way. Softwares like Substance Designer can extract any shade of a Clown Mask (Color ID Map) and apply it’s transformations on it.
I guess there should be a way to create a node that act like “Threshold” but for a Float3 instead of Float1.

I’ve made this material function that works fine for me

Hope this help, if someone need more info fell free to ask!

Christian Ronchi
www.chricchio.com

making a dot product betwen the texture and the desired color will give you a mask. apply a power node to that and you can adjust your threshold(dont forget to clamp the result). not perfect, but easy and fairly cheap.

Hi Christian,
Thank you for posting this. It is exactly what I’ve been looking for. Can you explain your node flow here? I understand the majority of it, but I am not sure what nodes you’re using for the “Input ColorID Texture(Vector3)”, "Input Color Masked (Vector3), and the “1-x”. I appreciate any help you can give me!

You might find it useful to have a dig through these functions I made:

http://i.imgur.com/tVWa9WN.jpg

You might also benefit from this function I made. It’s like an ‘if’ node, except you can have a ‘soft’ blend, it supports RGB inputs, and is a **lot **cheaper than using three ‘if’ nodes. (I haven’t checked it in a while, you may have to open it and set the ‘gradient input’ to vector3 to get it to work with RGB)

If anyone is still looking for a way to use a color ID mask in Unreal you can find a color ID mask function (any color) as part of Extile’s non repetitive tiling material here:

Short video on how it works:
https://www.youtube.com/watch?v=UHIHG9_hWWs&t=27s