Hi guys, shader graph newbie here.
I have been following some of the shader graph tutorials from youtube
and once again! having hard time understanding some of the nodes used.
I understand Dot product node as a node that gives you
the result of the difference in angles given from the input A and B.
(if the angle difference between the two node is zero, it gives you 1, using cos values)
So on the example above, I have plugged in vector 3 node to B, which gives you position of the vertex(normal vector) but I dont understand why the author of the tutorial plugged in Vector 1 node to A.
because far as I know it, it doesnt contain any data on normal vector.
(or will be considered as vector 3, like if the value is 1, is it considered as 1,1,1?)
Because of this issue, I have hard time predicting output values of Dot product node.
any light that will shed on this matter will be a great help to me.
Dot product does not tell you about angles, it just tells you how much your vectors are aligned. In case of two normalized vectors (those with the magnitude of 1, such as a normal vector), dot product equals 1 if the vectors are parallel and co-directional, 0 if they are perpendicular, and -1 if they are parallel but facing opposite directions. Feeding a float into dot product node is considered the same as using (1, 1, 1), so it would not be correct for this case. If you want (if I understand correctly) moss from the top, you should use an up vector (0, 1, 0) instead. You also should put a normalize node after the multiply node, because the magnitudes of your normals may change after multiplication.
Thanks Oxeren for your reply. just a follow up question though.
This is the rest of the node of the sample project that I ve been doing.
as you can see, dot product is connected to T value of the Lerp.
But is there any other information contained in the Dot product node, besides float ranging from 1- to 1?
because once I applied to my mesh, it doesn’t look like what I expect them to be.
(I’ve set my mossOffset value to 1,1,1)
isnt it supposed to cover whole part of the mesh with texture A or B based on the T value?
I’m not sure how moss offset is even supposed to work in this case, and calculating dot product with a float 1 also does not really make any sense. No, dot product does not contain any other information (though it can output values in other ranges, -1 to 1 is a special case for dot product of two normalized vectors).
You can use something like this to get the result you’re looking for (if I correctly understand what you want). You can also add properties to tweak edges of the smoothstep node.