UV Quadrant Masking

Just sharing a little trick I like to use sometimes to add variation to materials without having to create extra material instances on UE4.
The idea is pretty much that your object will be masked based on the location of its UV, those location being +U+V, +U-V, -U+V and -U-V.
And you can use those masks to drive different tints, or maybe add metallic areas to your object, use it to drive emissive color without having to use a texture map for it and many other possibilities.

Here is a example of my setup, I am sure there are other way to achieve the same result, and I am no tech artist, so if you know any way that is better optimized than mine, please to not hesitate to let me know, I will be happy to update the post with better info.

 

 

If you have any question or suggestion, just shoot me message.

 


Farfarer was kind enough to suggest the following solution:

vec4 udlr = step(vec4(0, uv.x, uv.y, 0), vec4(uv.x, 0, 0, uv.y));
maskUR = udlr.x * udlr.w;
maskUL = udlr.x * udlr.z;
maskDR = udlr.y * udlr.w;
maskDL = udlr.y * udlr.z;

your udlr vector would have 0 or 1 for each component, telling you whether the UV coordinate is in up/down/left/right respectively”

 

I haven’t had the change to try yet, but should be good!

Leave a Reply

Your email address will not be published. Required fields are marked *