I have tried with the following nodes in a material:
First I take a vector pointing upward from the object of the material a project it with project vector onto plane with the camera forward.
Then I take the Y axis of the camera and find the angle beetween the two with a dot porduct followed by arcosine (and eventually turn it into degree).
The following image shows what I would like to achieve:
It seems unfortunately the node is not as, when i plug the debug with the result, it shows me strange value, is the transform i’m using the problem or it needs something more complex to get the correct vector?
From the second picture it might not be clear but the plane is where the material is working and it can have any rotation, not only around the camera forward axis, this means that the up vector of the actor need to to be projected to the camera forward plane and then calculate the angle beetween the projected vector and the Y axis of the camera (or screen height transformed to world space).
In the following there is a more clear example of the effect with description:
Consider the image as the scene looked through the camera: we are looking at three plane with their Z axis showed as a blue line, the camera Y axis is green.
The three plane have their Z axis projected onto the camera screen and then, with a dot and arccosine math, we can calculate the three angle with the projected axis and the Y camera axis.
the expected result would be of:
a1 = 0 degree since it is parallel to the Y camera axis
a2 = 90 degree since it is perpendicular to the Y camera axis
a3 would be let’s say around 70/80 degree, notice that the a3 plane is not rotate alogn the camera forward axis but it’s in a random rotation, what it is important is the Z axis projected to the camera with the project vector onto plane node.
With the current setup the angles I have are seemenly random and not like the result in the pictures.
Ok, found the problem, I just needed to change the transform vector for the Actor Z axis from local to world space and the Camera Y Axis from view to world space.