2
$\begingroup$

I am trying to develop some materials with interesting optical properties. In doing so, I am investigating the use of the "View Vector", however I do not understand it. Looking at the documentation, it says it is a (unit) vector pointing from the camera to the point on the object.

However, the following screenshot suggests something different. I would expect taking the dot product of the "View Vector" with the object normals should yield a value of 1 when the object surface faces the camera, and a value less than 1 elsewhere, specifically zero for parts of the object perpendicular to the camera viewpoint.

The 3 objects in the screenshot show a) behaviour different to that expected and b) seemingly inconsistent behaviour. What is going on here?

Thanks

Camera View Vector example

$\endgroup$
4
$\begingroup$

The View Vector is in Camera space, but the Normal is in World space.

You need to transform one of the vectors to the other space if you need to compare them. I learned this now so I mark this question as helpful.

enter image description here

But this can apparently be simplified using the Incoming socket on the Geometry node. Incoming points towards the camera instead of from Camera towards geometry so the Absolute math node becomes redundant.

enter image description here

$\endgroup$
  • $\begingroup$ Perfect, thank you! Marked as correct. Can't mark as useful due to rep. $\endgroup$ – d401tq Feb 25 at 17:52
  • 2
    $\begingroup$ As a follow up, it seems that the 'Incoming' output from the Geometry node is a good replacement for 'View Vector', and does not require the Vector Transform node. Any comments on the difference between these two would be appreciated! $\endgroup$ – d401tq Feb 25 at 19:21
  • $\begingroup$ Good finding! I have updated the answer. $\endgroup$ – Jackdaw Feb 25 at 21:23
  • 1
    $\begingroup$ And just to confuse everything, if you ever use OSL, its I global variable points the other way from Geometry's 'Incoming' $\endgroup$ – Robin Betts Feb 26 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.