PDA

View Full Version : node editor: distance to camera



metallo
10-21-2009, 04:42 PM
would like to use spot info and calculate the distance from the active camera to a particular location on a surface, can someone give me some help?

i do NOT want to use a null to get position and subtract that from spot info to get distance, because that null would then have to follow my render camera and i have a rather complex scene where i don't want to track a null.

the camera info node lets me choose "render camera" but that node doesn't seem to have position information, which is rather odd.

thanks in advance, i've tried some searches but so far come up blank.

edit: by the way, i tried using "ray length" which is a great simple solution, but ray length isn't the same as distance to camera when you have anything transparent between the camera and the surface you are working with.

Sekhar
10-21-2009, 07:33 PM
Choose Item Info node and pick camera from the drop-down.

metallo
10-21-2009, 07:34 PM
that would be great if "render camera" were an option in the pick list. i don't want a specific camera, i want it to use whatever camera happens to be rendering that frame.

Jim M
10-21-2009, 08:27 PM
Easy peasy ...
Spot info node / Ray Length - Test it as an input to a gradient

Oh I just read the other bit .... I think you have to do a maths calc between the ray length and the bounces output....

metallo
10-21-2009, 08:29 PM
ray length does not work, there are transparent objects that interfere with certain rays, causing their "length" to be drastically shortened (as soon as they hit the transparent object). if it weren't for these other objects, the surface would work with "ray length"

Sekhar
10-21-2009, 08:35 PM
that would be great if "render camera" were an option in the pick list. i don't want a specific camera, i want it to use whatever camera happens to be rendering that frame.

Are you picking cameras through camera selector? You could always pick the node camera the same way you're picking your render camera. Not the most elegant, but it's simple and it'll do the job.