I want to paint vertices like the image (It is done in Photoshop). The first row is red with alpha 1 and the 6th row is red with alpha zero. I want to blend from 1 to zero in specific area.
-
Related : https://blender.stackexchange.com/a/78289/29586 - ‘smooth’ vertex colors over adjacent vertices. – Rich Sedman Mar 09 '19 at 09:57
-
Thanks for the reply. Unfortunately I don't have that much experience in Blender. Could you tell me how can I use this solution ? Also blender doesn't have this feature itself ? – ATHellboy Mar 09 '19 at 10:43
-
@RichSedman I opened your example and deleted that sphere and created plane and as you explained I painted those first row vertices and put those vertices in FIXED vertex group and then click run (Also I changed the name in the code to Plane). But all of the vertices change to red. What did I do wrong ? https://imgur.com/SoXu34P – ATHellboy Mar 09 '19 at 11:45
-
Sounds like you’re on the right track - The example in my file as it stands runs the ‘spread’ 250 times - so the color will spread over the whole mesh. Find the line that reads ‘for p in range(1,250):’ and change the ‘250’ to ‘6’ - so it only spreads part way - and you should get the effect you’re looking for (you’ll have to reset the vertex colors before re-running). Hope this helps - if not I can add a proper answer later when I get the chance. – Rich Sedman Mar 09 '19 at 11:56
-
@RichSedman Thank you very much. It works as I want but I want to know if it is possible instead of gray color, using black ? https://imgur.com/ZPHwEvC – ATHellboy Mar 09 '19 at 13:34
-
No worries - just change the line that reads “vert_colors[str(vertidx)] = (0.5,0.5,0.5)” which initialised to mid-gray (0.5,0.5,0.5) to initialise it to black instead (0.0,0.0,0.0) - each number represents the amount of red,green,blue. – Rich Sedman Mar 09 '19 at 14:06
-
@RichSedman Thanks. Your code is awesome. Just there is a problem which I don't know how to solve it. I show you in the image.https://imgur.com/a/VPLzhWY. I colored 2 row of all those top edge vertices and assign them into FIXED vertex group. – ATHellboy Mar 09 '19 at 17:20
-
@RichSedman Do you have any idea ? – ATHellboy Mar 09 '19 at 20:34
-
if you mean how the color separates from the side the the problem is that there is no source of color since the edge isn’t connected. One solution would be to connect opposite sides of your plane together by selecting both edges and using a ‘bridge’ fill to join it with faces, then remove faces only to just leave the ‘edges’ of the faces. This will join the sides so that the color bleeds down evenly. I should be able to write an answer later or tomorrow but have been away for a while. – Rich Sedman Mar 09 '19 at 22:08
-
@RichSedman I didn't get what you said. I appreciate for your answer. – ATHellboy Mar 10 '19 at 07:46
-
I've added an answer - hopefully this will help. Also, I think in your additional situation (where you've just colored the top vertices) you probably still have the 'side' vertices in the vertex group - this will effectively 'fix' them at black, producing the effect you're seeing. You need to 'Remove' those vertices from the vertex group to ensure they don't still affect the 'blending'. – Rich Sedman Mar 10 '19 at 08:24
1 Answers
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 Vertex Color Blend Add-on. To install the add-on, simply Download the file and use the User Preferences Add-ons 'Install from file' option and click the checkbox to enable it.
Once enabled you should have a new option in the Paint menu for Blend Vertex Colors
Go into Edit mode on your mesh and add a new Vertex Group - name it something like 'FIXEDCOLORS' and assign the vertices you want to have fixed colors to it. Ensure no other vertices are assigned to that group.
Use Vertex Paint to paint those selected vertices the desired colors - it doesn't matter if other vertices are also painted as those will be ignored by the 'blend' process.
Select the Paint/Blend Vertex Colors option and you should get a popup as follows :
Set the Number of steps and initial red, green, blue settings as desired and the Vertex Group to the 'FIXEDCOLORS' vertex group created earlier and click OK to apply.
After a short delay your vertex colors should be updated to blend the 'fixed' colors over the mesh.
- 44,721
- 2
- 105
- 222
-
-
Thank you very much. There is an error and I don't know what I do wrong. https://imgur.com/a/82x8RyI – ATHellboy Mar 10 '19 at 09:21
-
What version of Blender is this? I think the more recent versions of Blender have Alpha included in vertex colors (which it why it’s complaining about 3 instead of 4 - red,green,blue,alpha). I’ll make a change. – Rich Sedman Mar 10 '19 at 09:25
-
-
Thanks. Looks like at 2.79.6 there is an additional channel on Vertex Colors. I've updated the add-on to support either. – Rich Sedman Mar 10 '19 at 09:43
-
Thanks, I just checked it out. The error doesn't happen but it doesn't work like before. I assign top vertices to the FIXEDCOLORS vertex group and then paint them with red color then click on Blend Vertex Colors and set number of steps to 50 and others to (0, 0, 0) and click on OK but nothing change. But when I select 3 top rows and assign them to the vertex group and paint them it works. https://imgur.com/qFDVt4H / https://imgur.com/g8ClyvI – ATHellboy Mar 10 '19 at 10:12
-
@ATHellboy That’s strange - are you sure you don’t have extra vertices in the vertex group? Try deleting the verted group and re-creating it afresh. If that still doesn’t help, can you share your Blend file? – Rich Sedman Mar 10 '19 at 10:27
-
1Yup, seems it was vertex group problem but I don't know why because I check it couple of times :D. Thanks. Also that problem which I had is solved by this add-on. – ATHellboy Mar 10 '19 at 10:34


