I have made a donut in Blender with icing and spinkles on top. I would like to be able to have some of the color from the sprinkles bleed into the icing. I cannot find anything to help me achieve this. Every search result was how to get rid of color bleeding... the complete opposite of what I want!
Data Transfer a vertex color
A procedural approch would be to use vertex colors. Paint the icing black, duplicate the sprinkles and join them and paint them white. Duplicate the icing and join it with the joined sprinkles. In edit mode of this merged geometry, shrink the icing ⎇ AltS. Then (to the actual icing) add a subdivision modifier, add a Data Transfer modifier and finally another subdivision modifier using cycles experimental adaptive subdivision. Transfer the vertex colors from the icing_sprinkles_helper object to the icing. Use the vertex colors in the material to apply it to the color.
This procedural approach is complex, computing intense (many polygons) and produces mediocre results, so let's go with the destructive easy method.
Bake bleed to a texture
Temporarily change the lighting:
Unwrap the icing and create a new image. Add this image as an image texture node in the icing's material and select it (it should be active). We are going to bake on it.
- Bake the direct diffuse component of the icing.
We will now have an emissive map, this is not accurately bleeding, due to the random rotation of the sprinkles.Duh, whatever.
- Connect this texture to the fac of a color mix node, mixing icing color with sprinkle_bleed color.
You can also bake multicolored sprinkles, just separate the Value (used for the factor) and the Hue and Saturation (used for the color).