UV Image Color -> Vertex Color

Is there a way to assign the color of a vertex based on the color of a UV image. I have an image map, I want the end result to be colored only by vertices.

I see the the MFace object has a col attribute. I’d like to assign that attribute based on the actual image color at that point.

Regards,
John

Any thoughts on whether this is even possible would be helpful.

Hi. Maybe this script helps you: http://wiki.blender.org/index.php/Extensions:2.4/Py/Scripts/Image/LoadSave_VertCols , but I’m not sure if it makes use of UVs. It’s for B2.49.

That’s a very cool script (thanks!), but not what I’m looking for.

I’m looking for something that will take a UV Map and use the colors on the image associated with it to assign vertex colors.

There was an old version of the vectex script that seemed to display the colors per vertex or maybe it was built into blender.

Thanks but that does not appear to affect color vertex.

This is the method (for me works in Blender 2.49b only):

1- In GLSL mode assign a material (F5) and a image (F6) (create UV map, assign material (Shadeless button enabled), select image with coordinates UV)
2 - (optional) subdivide the mesh as desired for best results.
3 - Assign a vertex colors pressing the ‘New’ button of Vertex color in Editing (F9).
4 - Delete the image (F6) and in the Material (F5) enable the button ‘VCol Paint’.

This is vertex colors so you can see it is ‘GLSL’, ‘Texture Face Materials’ and ‘Blender Multitexture Materials’ mode in textured or shaded shading mode.

rather late response but here is :evilgrin: :smiley:

Enjoy!

I need the solution for Blender 2.63 please :wink:

Better late than never! It was fun popping open 2.49b. Your instructions are good, but the end result of the operations does not actually change the colors of the vertices. What I want is a way for the color of an image to be used to automatically (or via Python) change the color of a vertex so that I can then extract that value via Python. It’s all academic now, since I no longer need to do this, but if it is possible, I’m interested in learning it. For example, if I could get the color of the bitmap at a specific UV coordinate an map that to the corresponding vertex, I’d have what I need(ed).

Regards,
John

this script seems to do the exact opposite:

this looks like the right thing:
http://projects.blender.org/tracker/index.php?func=detail&aid=28211

but is apparently broken / not working with blender 2.5x / 2.6x

the addon author made a code review video, might be useful:

That script looks spot on, CoDEmanX! I look forward to trying it. Maybe I can unbreak it :slight_smile:

I tested it just yesterday with success. I assure you it works. The vertex painting adjunt I did it from a grass texture. Remember: This is a blend file for 2.49 version of Blender.

Attachments

image_to_vertex_colors.zip (467 KB)

i just submitted a fixed version of the UV texture to vertex color bake script for Blender 2.63+

http://projects.blender.org/tracker/index.php?func=detail&aid=28211

attachment > …v04.py
http://projects.blender.org/tracker/download.php/153/467/28211/21976/uv_texture_to_vertex_colors_v04.py

xaedro, I looked at your file (in Blender 2.49b) and attempted the steps again. Note that I am not referring to vertex painting, but to the transfer of the image texture color at a particular UV coordinate to the corresponding vertex automatically (or via Python) but not by manually sampling and painting. If we are both on the same page, can you look at your steps again and see if maybe something was left out?

CoDEmanX, thanks for updating the script to 2.63!

Thanks CoDEmanX, I have tested your addon in Blender 2.63 and works very well! Yay! :smiley:

Wow, this is driving me nuts. I’ve tried it several more times looking at both your steps, xaedro, and kane’s. I tried on both Mac and PC using Blender 2.49b. The images I’m trying it are JPG and PNG. I must be missing some step :confused:

Remember assign the image in the UV Image Editor.
An in the Matterial buttons panel (F5) set coordinates of the image to UV.

Also NOT enter to Vertex Paint Mode: In Object mode go to Editing buttons (F9) and press the ‘New’ button to the right of the ‘Vertex Color’ label.

I’ve been doing (and not doing) those things. Here’s something strange… I opened up one of my tests (after having completely exited Blender), it has the vertex colors assigned. I tried going through the process again, but no luck. Not sure why that one worked but didn’t show it was successful until restarting Blender, nor can I figure why none of my other attempts are working.

I just tried several more times, still won’t work. I’ve no clue why it worked the one time. It’s maddening.

I had continued trying it because there are times that it do not work for me.

And I think I found the reason:
Before pressing the ‘New’ button to create the colors of vertices must be in ‘solid shading mode’. Then go to ‘textured shading mode’ and (in object mode) delete the material and delete the UV layer in this order and see the results.

I think it’s like a ‘bug’ in Blender 2.49.