I have a node tree that generates random vertex colors per object that I have instanced onto a particle system. I have the effect working but have to bake it down to a single mesh and I'm trying to copy each object's vertex color into one final vertex color set on the merged object. I am currently exploring writing my own solution but I wanted to check if someone has come accross this first.

Cheers Ian


1 Answer 1


Welcome to StackExchange! First, you should know how to set vertex colors to meshes, this answer explains that in details. Next, note that the mesh resulted from joining all source objects has its vertices ordered such that the first n vertices are those of the first source object, the second n vertices are those of the second source object and so on where n is the number of vertices of the source object. So if we color every n vertices the same color, we will be fully covering each object with the same color.

Let's say we have a list of colors "Colors" where each color represents the color of an object, then we can repeat each color n times using this expression:

[color for color in Colors for _ in range(n)]

If we now set the outputs colors of the above expression to the mesh, we get what we want. But how do we know n (the number of loops)? All we have to do is sum the amount of vertices per polygon using a simple loop. So the full node tree becomes:

Node Tree

Where the script is from the answer I linked. This will produce:


  • 1
    $\begingroup$ Thanks for the information! I went through it all and eventually rebuilt most of my node tree. I ended up getting a bit stuck on the Transform Mesh node before realising they changed it to the replicate mesh data node. Your explanation was a great help! $\endgroup$ Oct 2, 2018 at 8:31
  • 1
    $\begingroup$ @IanMoore-kilgannon Glad I could help. Actually the replicate node was removed and replaced by the transform mesh node in the newest version, you probably have an old version with the replicate node. Please accept the answer if it answers your question. $\endgroup$
    – Omar Emara
    Oct 2, 2018 at 15:32
  • $\begingroup$ I have a follow up question for you. I am running into an issue with the particle death where the vertex colors don't get shifted as the first instance dies and the newer one is spawned. That causes all of the instances to flash different colors each frame as they are out of sync.I am not using the random vector method as I wanted more control over the colors produced. I have a loop producing a list of colors the same length as instances at that time. $\endgroup$ Oct 8, 2018 at 20:33
  • $\begingroup$ I then pipe that in and have the color list comprehention inside the script as the expression on its own was taking a long time to process. I was wondering if there is a good way of keeping the two in sync and shifting the entire vertex color set down one mesh on despawn. currently I'm running into issues where I can't get an accurate particle index because of the dying ones. Is there a better way to do this? Also trying to make it stable for Alembic export. $\endgroup$ Oct 8, 2018 at 20:33
  • $\begingroup$ @IanMoore-kilgannon The Particles Data node allows you to only return the dead particles, you can compute the number of dead particles by getting the length of the list containing their locations and use that number as an offset for your color list, effectively making them go in sync. $\endgroup$
    – Omar Emara
    Oct 8, 2018 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .