7
$\begingroup$

I'm using Cycles to make a procedural texture on an object, wanting to use the distance from an Empty in part of the calculation. I will use several Empties, in fact. Which node can provide this distance?

If possible, I'd also like the distance from a line, or other geometric measures involving objects other than the one I'm texturing.

$\endgroup$
  • $\begingroup$ What about using drivers? $\endgroup$ – gandalf3 Mar 13 '14 at 20:30
11
$\begingroup$

You can use Drivers to do this.

  1. Add a value node, then right click on the number button and select Add Driver

    enter image description here

  2. In the Graph editor, switch to drivers in the header:

    enter image description here

  3. Select the driver on the left panel, then set it to Sum values or Averaged value to avoid your driver being blocked by the python security features. Then set the variable type to Distance and select the empty and the object to which the material is assigned. Unfortunately there doesn't seem to be a way to reference the object(s) to which the material is assigned without specifying them individually with separate drivers.

    enter image description here

$\endgroup$
  • $\begingroup$ Very cool, @gandalf3. I didn't realize this was in there. Suddenly I have a solution to several other problems! $\endgroup$ – Chuck Feb 2 '15 at 18:23
7
$\begingroup$

it's possible with texture coordinate node, with the object output. You get the distance of X, Y and Z from the empty mesh-wise, so you apply sqrt(x² + y² + z²), though you don't get an unique value of distance.

enter image description here

$\endgroup$

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.