Some questions about results when combining VertexNormalWS + Mask : how does it work?

Hello!

Turbonoob question, I’m trying to make sense out of shaders so I’m starting out small. I apologize in advance if the question is missplaced or pointless.

I create this very small shader with a VertexNormalWs and a mask on the red channel, this makes the rendering sphere white on the x-axis and black on the other side, as that is -1:

Similarly, I turn on the green channel, now the y-axis positive side becomes white, negative side black:

So far, so good. I understand. But! I turn on the red+green channel on the mask, the result becomes coloured:


… and I’m lost. If i turn on all three channels, this is the result:

Why does it do this? Why does it become colored when multiple channels are turned on, but only white according to its axis when singular channels are turned on?

Hi baalimago,

It’s because you’re mixing the 2 or 3 channels of data from the VertexNormal in to the RGB - in the example of 2 channels (masking R&G) , it’s black where both R and G are -1, Red where R is 1 and Green is -1, and when Red is 1 and Green is 1 - thats RGB=1,1,0 - mixed together, that’s yellow. Think of it like you’re adding “1” part of Green Paint and “1” part of Red Paint…

The same applies for the 3 channel mix, but with all 3 channels combining.

Thank you for quick reply!

I suspected this, but if this is the case, why are the first two pictures white? Surely, picture number 1 (showing red channel mask) should be red and black, and picture number 2 (green) should be green and black? This is the part I can’t wrap my head around.

Yes, good spotting! The input pin for Base Color detects when it’s only 1 channel, and converts it to greyscale if it is…

Ah, I see. This makes sense. Many thanks, have a nice weekend!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.