I'm having trouble working out the correct combination of nodes to effectively green screen a texture, I've been using 100% magenta as a block color on the UV sheet to indicate a texture I want to be replaced via the shader settings but I've yet to find out a way to convert magenta areas of a sheet into a mask before replacing the colors with variable defined ones.
Just a simple case of adding programmatic team colours to a uniform but I'm unsure how to go about it, any help would be useful.
Replies
I might know a way, but would be highly inefficient.
I understand how to make a greyscale emissive map and multiply it with a colour value to make different glowing lights and such but was hoping to just have a diffuse colour reassignment option.
i presume you cant do something as simple as an if node?
if not then there's a dirty hacky way to do it - multiply your blue and red channels together and you'll have pure white where you had pure magenta. multiply this output by 100 then clamp the resulting texture to the range 99-100. then just subtract 99 and you will have a black and white mask where you had pure magenta with a 1% margin of error. if its not accurate enough you can start using bigger numbers but that should be more than enough.
hope that helps
Honestly just wished the documentation was far more detailed.
Edit: Could use two UV sheets, and keep the areas I want to color in the shader on sheet 2 but it's really a pain.
Although without the ComparisonOp taking a float3 as an input or being able to cast between bool-int-float data types it's not all too easy to compare two colors. "Is this pixel colored with the predefined team color"?
ShaderFX is still quite new to me. But from what I see, when it comes to creating this with the set of nodes available it's clunky.
http://help.autodesk.com/view/MAYAUL/2015/ENU/?guid=GUID-355DCB0C-D9A6-4B59-8AFB-CBA7E1067D60
Turns out you don't have to worry about casting as much as I had believed. Guess I'm stuck in my old Mental Mill habits. I gave it a go just now and here's a way you could go. Although as you can see this only handles just the very exact color. So as long as it's entire UV-islands it's no issue, otherwise you'd have to improve on this or find a different way about it. Hope it helps.
Posted the Texture sheet, the node graph and the result. There's an annoying 1px outline stroke which according to Photoshop is 100% Red (at first assumed it was aliasing blending with the text). I'll look at your node graph and method and give it a shot. Might turn out to be a productive thread after all
Maybe sacrifice the Alpha channel to store a mask for what should be team color areas? That way we could still keep brightness values in the RGB channels for these areas. Also deal with the unwanted pixels at the perimeter easily if we go 8-bit alpha. There's loads of way to optimize on this concept though.
Alpha channel masking is an option too, but now I know the rough logical layout of what was done in your node graph I can look up the documentation for each node and tweak it accordingly to needs. Thanks, you've been a big help.
Here's an example with just two ranges instead of three, made with the old Shader FX in 3ds Max. Might give you some ideas. I can probably dig up a higher-resolution shot if you need one.
The model in the GIF is one of my talented students model(with borked shading atm) from a few years back.
We can definitely do better there.
Try starting at: http://www.shaderfx.com/
There is also a new Gnomon workshop for ShaderFX / VP 2.
I have not seen it myself, so hope its good.
The Maya help docs have basic help to get started and quite a lot of Unreal tutorials can be applied in ShaderFX with some adjusting.
Hope that helps a little.
-Kees
It's an excellent bit of software and having done basic GLSL before I'm glad I don't have to touch it as much any more.
Keep up the good work, I'll look at the Gnomon course for sure.