View vectors of materials with nodes

Hey everyone!

I’m messing around with some material node math; the details of which aren’t super-important to the question so I will spare you of them :slight_smile:

Fundamentally, I would like to do some mathematical operations on the vector between the camera and the material. I figured that the View vector from the camera input would do what I’d like, but I couldn’t find documentation or anything in these forums about the nature of that vector.

Through some experimentation, I found that this vector describes the position of the material within the camera frame. That is to say, the maximum value of X is a horizontal line in the middle of the frame, and the maximum value of Y is a vertical line in the middle of the frame, falling off towards the edges. Z doesn’t seem to have anything in it. I also played around with vectors provided from the Geometry input node to no avail.

Is there any way for me to access a vector that defines what I’m thinking of the view here, rather than the position in the camera-coordinate-frame? It would be nice to hand-code a node, but I understand that was a buggy part of 2.49 (threads I have read suggested that PyNodes would not update reliably?), and that is not possible in 2.52 (what I’m using). I’ll gladly switch if what I’d like to do would be easier!

Thanks in advance,

Tron

Hi,
I have a basic knowledge of vectors and coordinates, I might help you.
In the “Camera Data” input node there is:

  • View Vector - basically X and Y coordinates of the viewport.
  • View Z Depth - well it is Z Depth
  • View Distance - distance from View Position to Vertex

anything specific you need?

Yeah, that’s exactly what I’ve noticed… unfortunately what I really need is the X, Y, and Z of the vertex relative to the camera.

I’ve thought about possibly manipulating the View in combination with the Depth to calculate the actual X, Y and Z, but my problem is that it would involve guessing at the units of the camera focal length, plus it would change if I change the camera parameters.

Is the kind of info I’m looking for available if I use PyNodes in an older version of Blender? Is it possible to somehow write my own nodes for 2.52?