I have a single, the all-in-one mesh object created and then vertex-painted with a script. I can see the colors in vertex paint mode, but I haven't been able to successfully turn it into a renderable (or even viewable) material.
I've been working from this very helpful answer. Here is a bit of the script:
vcols = ob.data.vertex_colors if len(vcols) == 0: vcols.new() vcols[-1].data.foreach_set("color", flattened_colors)
I also created the attribute node, but I'm not sure exactly how to use it. Are the vertices "painted" as soon as I run the above lines? What is the purpose of the attribute node? Is it only for conversion to a real material?
I tried to make a material using the script below, so far it doesn't seem to work (it shows as all black or all white when viewing material).
I'm basically using these pieces of the puzzle without understanding how they interact. What I need is a short description of the bits of script and the nodes, and how to get them to work together... "this does this, that does that, do them in this order."
Here is what I've done so far - make sure to scroll all the way through:
Then I execute the following lines, found similar here:
mat = bpy.data.materials.new('vertex_material') mat.use_vertex_color_paint = True mat.use_vertex_color_light = True # material affected by lights obj = bpy.context.active_object obj.active_material = mat
The nodes disappear, the material appears but I end up with a white material.