# How do I access vertex positions in the material editor?

**URL:** <https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456>\
**Category:** Rendering\
**Tags:** vertex, position, vertex-position, unreal-engine\
**Created:** [January 19, 2024, 4:01pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456 "2024-01-19T16:01:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DmitriySorv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DmitriySorv](https://forums.unrealengine.com/u/DmitriySorv)\
**Post date:** [January 19, 2024, 4:01pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/1 "2024-01-19T16:01:56Z")

</div>

I need to access vertex positions in order to calculate for each vertex separately how far and where to move it. I already have all the logic working, but I’m using Absolute World Position, which now gives artifacts when changing the camera location (the vertex position is constantly changing and feels like a bug, not a feature). Please advise, perhaps there is some code in HLSL that will help access the vertex positions?

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [January 19, 2024, 4:38pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/2 "2024-01-19T16:38:08Z")

</div>

> [@DmitriySorv](#):
>
> Absolute World Position

This is the right way to do it.

Are you very far from the world origin? Might be a large world coordinates issue as its not supported for the GPU yet

---

<div class="post-metadata">

**Author:** ![DmitriySorv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DmitriySorv](https://forums.unrealengine.com/u/DmitriySorv)\
**Post date:** [January 20, 2024, 7:15am UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/3 "2024-01-20T07:15:58Z")

</div>

> [@Arkiras](#):
>
> This is the right way to do it.
> 
> Are you very far from the world origin? Might be a large world coordinates issue as its not supported for the GPU yet

I’m at the origin of the coordinates. Using Absolute World Position will not work, because artifacts appear when changing the camera position. I think that I should add colors to the mesh vertexes, use the object coordinates and when folding I will also have constantly changing values.

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [January 20, 2024, 10:06pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/4 "2024-01-20T22:06:18Z")

</div>

> [@DmitriySorv](#):
>
> Using Absolute World Position will not work, because artifacts appear when changing the camera position

Are you sure you’re not using camera relative world position?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/0/8b01cd42f31d0611f3185419a53db38807693213.png)

---

<div class="post-metadata">

**Author:** ![DmitriySorv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DmitriySorv](https://forums.unrealengine.com/u/DmitriySorv)\
**Post date:** [January 21, 2024, 7:00am UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/5 "2024-01-21T07:00:01Z")

</div>

I used Absolute World Position.

I can record a video later that shows the artifacts. If you’re interested, of course

---

<div class="post-metadata">

**Author:** ![ilya.83](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ilya.83](https://forums.unrealengine.com/u/ilya.83)\
**Post date:** [July 27, 2024, 2:02pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/6 "2024-07-27T14:02:04Z")

</div>

But documentation states that the AbsoluteWorldPosition node “…outputs the position of the current PIXEL in world space”, so it can’t be used in the vertex shader or to get the vertex position, right?

---

<div class="post-metadata">

**Author:** ![BananableOffense](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BananableOffense](https://forums.unrealengine.com/u/BananableOffense)\
**Post date:** [July 27, 2024, 4:22pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/7 "2024-07-27T16:22:04Z")

</div>

Yes it can be used in the vertex shader to return the vertex position. In the fragment shader, it returns the interpolated position of the pixel.

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [July 27, 2024, 7:58pm UTC](https://forums.unrealengine.com/t/how-do-i-access-vertex-positions-in-the-material-editor/1626456/8 "2024-07-27T19:58:51Z")

</div>

What @BananableOffense said, also you can force some things that would normally run in the fragment shader to run in the vertex shader by using the Vertex Interpolator node.
