# Accessing a Material Vertex Paint Color Value

**URL:** <https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414>\
**Category:** Rendering\
**Tags:** linetrace, vertex-paint, unreal-engine, Blueprint, question\
**Created:** [April 1, 2019, 8:14pm UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414 "2019-04-01T20:14:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nameLive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nameLive](https://forums.unrealengine.com/u/nameLive)\
**Post date:** [April 1, 2019, 8:14pm UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414/1 "2019-04-01T20:14:05Z")

</div>

Hi

I want to somehow access the vertex paint color value under the player 0 or 1 was painted to determine whether the player is for example standing over painted grass so you could have the proper walking sound playing.

Anyone know if this is possible in Blueprint?

Getting the material and physics materials etc. is easy enough with linetrace and i’ve tried messing around with getting the Collision UV Index but cannot seem to get or see any difference when i’m linetracing over the painted part.

Thanks!

---

<div class="post-metadata">

**Author:** ![nameLive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nameLive](https://forums.unrealengine.com/u/nameLive)\
**Post date:** [June 30, 2020, 5:23pm UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414/2 "2020-06-30T17:23:55Z")

</div>

After alot of research and testing i’ve come to the conclusion that it is not possible through blueprint, only C++.

You can either go through the Vertex buffer:  
FColorVertexBuffer\* colVertBuffer = &meshCompTemp-\>GetStaticMesh()-\>RenderData-\>LODResources[lodData].VertexBuffers.ColorVertexBuffer;

TArray colorDataFromBufferTemp;

colVertBuffer-\>GetVertexColors(colorDataFromBufferTemp);

Or through PaintedVertices under the LodData:  
meshCompTemp-\>LODData[lodData].PaintedVertices[i].Color

However, both of these are not viable in packaged builds since the data gets serialized, things like position of the vertices are available if you check the Allow CPU Access and use the vertex buffer but this is because the positions and normals of the vertices are always the same, the color are different from the default ones and with Allow CPU Access you can only access the default values in the static mesh, not the ones painted out on an instance of that mesh.

---

<div class="post-metadata">

**Author:** ![dejwifati](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dejwifati](https://forums.unrealengine.com/u/dejwifati)\
**Post date:** [December 12, 2020, 10:43pm UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414/3 "2020-12-12T22:43:14Z")

</div>

Thanks for doing the research! I had exactly the same use-case, and indeed it seems that packaged builds do not populate LODData arrays. (weirdly enough first method was not working for me in the editor either, but maybe I did something wrong).

I guess for now I will resort to reading the paint data in Editor, saving it to a file and loading this in packaged builds ;/

---

<div class="post-metadata">

**Author:** ![nameLive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nameLive](https://forums.unrealengine.com/u/nameLive)\
**Post date:** [December 12, 2020, 11:25pm UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414/4 "2020-12-12T23:25:09Z")

</div>

For it to work in editor you must have CPU Access on the Meshes.  
Yea that’s what i did as well, i have plugin that does all of this comfortably on the way and i expect it to hit the epic store in march/april:  
[https://www.alexanderfloden.com/vertex-data-detection-plugin](https://www.alexanderfloden.com/vertex-data-detection-plugin)

---

<div class="post-metadata">

**Author:** ![dejwifati](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dejwifati](https://forums.unrealengine.com/u/dejwifati)\
**Post date:** [December 13, 2020, 12:40am UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414/5 "2020-12-13T00:40:14Z")

</div>

That sounds great! I will keep an eye on your plugin!

---

<div class="post-metadata">

**Author:** ![cannasoftware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cannasoftware/32/552495_2.png) [@cannasoftware](https://forums.unrealengine.com/u/cannasoftware)\
**Post date:** [August 20, 2022, 6:17pm UTC](https://forums.unrealengine.com/t/accessing-a-material-vertex-paint-color-value/446414/6 "2022-08-20T18:17:13Z")

</div>

Watched your video and it doesn’t explain where you get the info for macOS. This changes for each version ( 😭) so here is a link with a description in detail.

It’s TEXT so you can print it off, copy it, etc.

> [@UE Development Environment for MacOS Monterey?](https://forums.unrealengine.com/t/ue-development-environment-for-macos-monterey/548059/2):
>
> UE5 and Xcode is a nightmare. Autocomplete does not work. Period. Full stop. Under UE4 I USED to be able to turn an Xcode project into a VSCode project (and compile, etc) using the following: cd /Users/Shared/Epic\ Games/UE\_4.XX/Engine/Build/BatchFiles/Mac ./GenerateProjectFiles.sh -project=\<path-to-dot-uproject\> -game -vscode (XX being the UE4 version number) If I try the same thing with UE5, I get an error. I got VSCode under UE4 to give me hinting, etc on macOS, but you have to tell i…
