How do I set colors of objects based on their distances from some reference object, an empty for instance.


1 Answer 1


You can use the Set Vertex Color Node to color the objects, I will compute the distance between an empty and some objects, then loop over the objects, create a color based on the distance and set it:

Node Tree

The previous tree uses the distance as the hue, which produces:


But we can use it as the value for instance:

Result 2

To use the vertex color as the color in a material, we check Vertex Color Paint in the material options:


Lastly, if you are using the Object Instancer Node to make the objects, make sure to check Deep Copy making each of the meshes independent. And of course, give the source object the required material.

  • $\begingroup$ Omar, can I look at your bend file? I'm doing something wrong ... $\endgroup$ Mar 30, 2018 at 23:31
  • $\begingroup$ And also how to do it for Cycles? $\endgroup$ Mar 30, 2018 at 23:43
  • $\begingroup$ YES!!!! I Did it) prntscr.com/iytobu prntscr.com/iytpbs Thanks for your help Omar! But the gradient is looped! Is it possible to make so that next to the object there was a certain gradient. And no matter how far the controller is from the grid, the color was always different? $\endgroup$ Mar 31, 2018 at 6:31
  • $\begingroup$ @SergeyGolubev You can multiply the distance by some scalar to control how much times it is looped. If you want it to stop at the last color, use the Clamp Number Node to make it between 0-1. $\endgroup$
    – Omar Emara
    Mar 31, 2018 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .