Face selection masking is available in the 3D header when in 'Vertex Paint' mode:
Because this works on faces you will only be able to paint vertices that make up a face, individual vertices or edges won't be filled.
Select the vertices you want to paint on in edit mode.
Change to 'Vertex Paint' mode.
Enable 'Face selection masking' in the 3D header. There ...
It's not as full-featured as the script you've posted, but I've come up with a very simple Bake-UV-to-Vertex-Colors script:
# Lookup the image by name. Easier than trying to figure out which one is
# currently active
image = bpy.data.images[image_name]
width = image.size
height = image.size[...
One way you can do this is with the mask modifier:
Add a vertex group of the vertices you want to paint on (or the area you don't want to paint on, whichever is easier)
Add a mask modifier and toggle the invert option if you selected the vertices you don't want to paint on.
Paint, then disable/delete the mask modifier when you are done.
You can bake Vertex colors to a texure.
Starting from a vertex color layer as in the picture below
you must unwrap your model (which may consist of one or multiple meshes) and create a new image to bake onto ("untitled" in my case)
Than go in the Bake panel of the Render tab and set Bake mode to Vertex color.
When the process is completed you should see ...
The gradient is linear but not in the colourspace you are expecting - as evidenced by the following :
Here the Attribute node is making the Vertex Color (Col) available to the shader. This is split into separate RGB components and compared with the Generated 'X' coordinate (which runs from 0.0 at the left to 1.0 at the right of the cube).
The gradient is ...
Adjacent faces can have different plain colors, and a vertex can have a different color for each face it participates to.
In 2.79, it's possible to select the faces in Vertex Paint mode, and use 'Set Vertex Colors' (Header > Paint menu or Shift-K).
Likely the integration in Blender of a separate script that was used before.
To view colors in ...
Select faces in Edit mode
Switch to Vertex Paint mode and press Face selection masking for painting button (3D view -> bottom panel -> button with cube icon (next to layers selection)
Press ShiftK to fill selected face with the selected color.
This way, you can also normally vertex paint your model but painting will be limited to selected faces only.
Answering my own question here. Looks like if I use Collada exporter the colors are correct. So they must use linear color space. Maybe it is more of a responsibility of the export plugin to set the color space used than Blender.
Look at the loop vert.
Using a method similar to Applying per-vertex colors to new Bmesh
from random import uniform
context = bpy.context
mesh = context.object.data
bm = bmesh.new()
color_layer = bm.loops.layers.color.new("color")
red = (1, 0, 0, 1)
black = (0, 0, 0, 1)
for face in bm.faces:
for loop ...
In general, it doesnt sound as useful to draw narrow circle in Vertex Paint. For such result you would need a lot of vertices or very specific vertices for this purpose. It would be better if you can closer describe what is your goal. Maybe you dont need to use a Vertex Paint for it.
Narrow circle you can achive by many ways ...
version 01 Material
In Weight Paint Mode you can set Weight by pressing Shift + K.
Toggle Vertex Selection Masking to select the vertices
Set the Weight (use @joshsanfelici technique to copy vertex value)
Press Shift + K to set weight
You can achieve this using Texture Paint and a carefully crafted UV map with each face taking up the space of only one pixel. This will mean that the entire face relates to a single pixel in the image texture and is therefore painted a single consistent color. The UV map and the associated image can be created with a script.
Open a Text window, click New, ...
Go to Edit Mode and select what you want to Polygroup.
Go to Object Data tab and click plus next to Vertex Group then assign with your selection active and name if you like.
On obj export make sure the Polygroup box is checked.
ZBrush doesn't use smoothing like Blender does you need to subdivide to make it look smooth.
Vertex painting is much more limited. Your mesh's resolution is the upper boundary to the texture detail you can have, since essentially you only have one color per vertex (this color can be a compound of several colors for each edge loop that a vertex is on, but it sums up to just one RGB value).
UV textures enable you to map a 2D image to your 3D mesh. ...
Similar to the answer to Smoothing vertex_colors values this can be achieved by assigning the 'fixed color' vertices to a Vertex Group and using a script to 'smear' the color from those vertices over the rest of the mesh.
You could use the script in the linked answer but for ease of use I have packaged it into an add-on which is avialable for download from ...
Yes, you can select vertex while in paint mode. Just switch to the select tool and change selection mode to vertex. Also note that if you select vertex in edit mode and then switch to paint mode, the selection is preserved and edit mode has better ways to make selections than paint mode does.
With your selection just set the colour you want and use the ...
You must set vcol with loop index, not vertex index, because those are loop data (i.e. one color per face corner):
current_obj = bpy.context.active_object
mesh = current_obj.data
vcol_layer = mesh.vertex_colors.active
vcol_layer = mesh.vertex_colors.new()
for poly in mesh.polygons:
Having such problems with mask created by Vertex Paint:
First check whether there are double vertices (W >
Recalculate normals with Ctrl + N. The result
is better but still weird, something like:
Continue using Vertex Paint, simply drawing over these gaps and
smoothing boundaries and it's done.
I think that is not possible to configure the vertex paint brush with the options provided by Blender at this time (2.75a) without scripting yourself the tool you need.
The vertex brush simply cannot "see" the face, probably because it's normal is not facing the brush projection enough...or something like that...
I'm not a coder as you might have guessed, ...
That looks to me like you have a few overlapping faces. The give-away is that there's some shimmering (called "z-fighting") going on between unpainted white vertices and the yellow verts.
With Vertex Painting you can limit the faces using a Mask. Any unmasked faces will receive no vertex paint instructions.
This masking mode lets you right click faces to ...
If you used bpy.ops.screen.screenshot(ctx, filepath=destination, full=False) in the correct context it would save a screenshot of what you see in the viewport, but render.render() isn't the same as doing a screenshot.
I think you're getting something like this?
You need to set up a material to pipe the Vertex Color Layer to the material diffuse colour. ...
Thank you @Mr Zak, you got me pointed in the right direction. Going through the first links github, I found this... https://github.com/varkenvarken/blenderaddons/blob/master/connectedvertexcolors%20.py … It adds an option to fill each piece of the object with a random color while in vertex paint mode. Thanks!
I'm aware I'm necroin' a 8 month post, but I'd like to aid any others who happen to come across this post in desperation for a solution.
It took a whole day of investigating and cross-referencing, but another Blender user back in 2010 managed this effect rather well.
Now, the barely readable 480p is not very helpful for those ...
Okay I think I may have found the issue? Where you have an Add node I think you really want a Multiply node, as follows:
And the render looks more like this:
Which seems more like your reference photo I would say.
Well a few minutes after I posted the question here, I sent the question into a Slack Group and Julian Perez (@julper) found this great addon that fits exactly to what I was needing.
I will share what he found with you.
The addon is called Weight-and-Color
If you run into this problem again, I suggest using the glTF exporter in Blender. The spec requires it to export the vertex colors in linear space. There was a time when this was not working properly, but I have verified that Blender 2.8 Beta appears to be doing the right thing.
If you look at the image below, these pumpkins are both the same model, ...
You can apply the currently active vertex color for all vertices at once while in Vertex Paint Mode. Just select (Paint -> Set Vertex Colors) from the header menu. Basically, you set the dominant vertex color for the whole mesh and then manually paint a few vertices afterwards.
While this doesn't work on a selection but only the whole mesh, you might want ...
You still have to go through some steps, but you can save yourself from having to paint the colors on in a tedious way.
Here a little explanatory video:
It's with your words, "flood filling" all black first, then selecting only the faces you want red and setting their color as well.
Change to Vertex Paint mode and in activate paint mode, to select the ...