I am trying to set Vertex Colors in Blender to control selecting an Index for a Texture 2d Array.
I was able to get the index to change by when I change the value of the vertex color by 0.05. However, I am trying to get 256 (0-255) and I am unable to figure out how to convert the linear color of the vertex color to a 0-255 value for my texture 2d array sampler?
I guess this is so simple may be why it is so hard to find info on this?
Figured it out by having ChatGPT create a python script to create an array of planes, and give the vertex colors of each plane evenly distributed values between 0-1. I also had to output the vertex colors as sRGB in Blender instead of Linear Color, which seemed odd to me as I would think sRGB wouldchange the values of the vertex colors.
Blender Export with sRGB Vertex Colors, then in Material, multiply vertex channel by 255 and append this value to the texcoord and this goes ito the UV input for the texture array
Blender Pythoin Code for Vertex Grid Test Static Mesh
To set the value for vertex color in Blender, find its index in the texture array, and type in “Index/255” to get the correct value for the index.
I Finally figured this out:
When you create a Vertex Color Layer in Blender, you have to choose “Byte Color”
When you export the FBX, Vertex Colors must be set to sRGB in Export Options
When setting the Vertex Color in Blender, enter the value as index/255 (index = Texture Array Index # in your UE Texture2DArray and 255 is the number indexes (whatever yours may be (does not have to be the actual number of existing indexes, but the total you eventually plan on having)
You can see here, I currently have 28 Textures in Array, but will be able to add up to 256
This model had 11 Material Slots and now all use the same Material
I guess you are unable to delete materials imported from FBX, so now I have to go back into model and delete all but 1 Slot, but you can see each texture is applied to correct areas of mesh
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.