Instances positions for node material editor

Hey guys!

I have a question regarding the node material editor. I am wondering if this is possible inside the nme:

  • I want to load a scene that contains quite a few instances
  • I want then to take into account each instance’s position
  • I want to create a material and apply it to the instances. The material the material should change its color based on the distance from the camera, or based on the fact that the camera is facing it or not.

The problem is I don’t have any idea about how to obtain the position of each instance in the node material editor.

Is there a catch? As far as I noticed, the output of the “Instances” node is a matrix, but the rest is a bit foggy for me.

Thank you!

You will get the world position by multiplying the output matrix from Instances with the mesh position:


Thank you, Evgeni!

I will give it a try.