# How can I iterate through pixel indexes of a texture in materials

**URL:** <https://forums.unrealengine.com/t/how-can-i-iterate-through-pixel-indexes-of-a-texture-in-materials/348735>\
**Category:** Rendering\
**Tags:** kinect, unreal-engine, UE4, question\
**Created:** [February 26, 2016, 9:09am UTC](https://forums.unrealengine.com/t/how-can-i-iterate-through-pixel-indexes-of-a-texture-in-materials/348735 "2016-02-26T09:09:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![plangton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plangton](https://forums.unrealengine.com/u/plangton)\
**Post date:** [February 26, 2016, 9:09am UTC](https://forums.unrealengine.com/t/how-can-i-iterate-through-pixel-indexes-of-a-texture-in-materials/348735/1 "2016-02-26T09:09:56Z")

</div>

I want to map the kinect depth texture to real points. I have the formula and have implemented it in materials a material function.  
the formula convert each X,Y of the image ( the index of each pixel in depth image texture ) to the real world X,Y. my question is that if I multiply texture coordinate node in materials with Width and height of the desired texture will I get the pixel index of a texture ? if not then how can I ?

---

<div class="post-metadata">

**Author:** ![plangton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plangton](https://forums.unrealengine.com/u/plangton)\
**Post date:** [March 24, 2016, 1:44pm UTC](https://forums.unrealengine.com/t/how-can-i-iterate-through-pixel-indexes-of-a-texture-in-materials/348735/2 "2016-03-24T13:44:02Z")

</div>

you assumption is correct, you will get the pixel index by multiplying coordinate shared with texture to the width and height.  
i have done un-distortation of kinect X and Y and is fairly simple
