I'd like to do arbitrary vector math with the camera position, shading point, and possibly other points. As a test case (blend file), suppose I want to make a shader that will draw a simple gradient based on distance from the shading point to the camera in one of two ways.
The two methods of getting the desired distance are:
"Camera Data.View Distance" as the control.
Computing the length of a vector equal to the unit vector given by "Camera Data.View Vector" multiplied by the scalar "Camera Data.View Distance". This is the issue.
The node setup looks like this:
What can I put in the "Vec * Scalar?" frame so that the material will look the same no matter how the "Selector" Mix Shader Factor is set?