View Full Version : How to make a Node Gradient controled by null object

01-06-2011, 08:43 AM

I need help,
I try to make a gradient on a object to save a clean depth AA map an customized DOF.
To do that I have try the gradient in "standard" surface menu with a input of Z ditance to object.
It's work fine when the object and camera are aligned with z axe of the scene.
I would like to do the same thing with the node editor and with the local axe Z of the control object (null).
Anyone have a solution or a tutorial or a database to explain how the node works to do this ?

I have attached the test scene. at 0 all is ok (camera + object control aligned with z. At 60 not ok the garadient are not aligned with the camera.
I think the the only solution is with the node editor, but I don't know how...
Help me please !

01-06-2011, 08:47 AM
You can add Spot Info and Item Info, connect spot World Position and item World Position to Math > Vector > Distance, and feed Gradient node. It'll be in meters.

01-06-2011, 09:13 AM
Many thanks Sensei !
It seem that works in world reference axis, but I would like this effect only on the local Z axis of the control object Focus (to simulate a dof gradient).
Here we have a "radial effect" gradient, I would like a "Linear" gradient effect on the Z axis of the control object.