# Instances positions for node material editor

**URL:** https://forum.babylonjs.com/t/instances-positions-for-node-material-editor/47554
**Category:** Questions
**Tags:** material, instances, nodematerial
**Created:** [January 26, 2024, 10:54am UTC](https://forum.babylonjs.com/t/instances-positions-for-node-material-editor/47554 "2024-01-26T10:54:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Florin\_Necula](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/florin_necula/32/22720_2.png) [@Florin\_Necula](https://forum.babylonjs.com/u/Florin_Necula)
#### Post date: [January 26, 2024, 10:54am UTC](https://forum.babylonjs.com/t/instances-positions-for-node-material-editor/47554/1 "2024-01-26T10:54:51Z")

</div>

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!  
Florin

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [January 26, 2024, 11:09am UTC](https://forum.babylonjs.com/t/instances-positions-for-node-material-editor/47554/2 "2024-01-26T11:09:55Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/8/48c4daea28b17b6dc5bc13f1ddbd0399e008d337.png)

> **[Babylon.js Node Material Editor](https://nme.babylonjs.com/#LUFYH5)**
>
> Babylon.js Node material editor - shader-based materials editor for Babylon.js

---

<div class="post-metadata">

### Author: ![Florin\_Necula](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/florin_necula/32/22720_2.png) [@Florin\_Necula](https://forum.babylonjs.com/u/Florin_Necula)
#### Post date: [January 26, 2024, 11:52am UTC](https://forum.babylonjs.com/t/instances-positions-for-node-material-editor/47554/3 "2024-01-26T11:52:27Z")

</div>

Thank you, Evgeni!

I will give it a try.

Cheers!
