Page MenuHome

Bakes the colors of the active UV-Texture to Vertex Colors
Closed, ArchivedPublic

Description

Project: Blender Extensions
Tracker: Py Scripts Contrib
Python: 3.2
Blender: 2.63
Author(s): Patrick Boelens, CoDEmanX
Script name: Bake UV-Texture to Vertex Colors
Wiki page: http://wiki.blender.org/index.php?title=Extensions:2.6/Py/Scripts/UV/Bake_Texture_to_Vertex_Colors
Category: UV
SVN Download: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/uv_bake_texture_to_vcols.py
Status: >Release

Features:
- Bakes colors from the active UV Texture from the UV/Image-editor onto the vertices' Vertex Colors based on the position of their UV-coordinates.

Setup:
- After installing the add-on it should work automagically. ;)

Manual:
- First, unwrap the model like you normally would.
- Next, load in the image you wish to bake into the UV/Image-editor.
- The color baked to each vertex depends on the position of their UV-coordinates; it takes the color from right underneath it.
- In Vertex Paint Mode, open the Toolshelf and click 'Bake UV Texture to Vertex Colors' under 'Bake'.

Quick test set-up:
- Enable the add-on
- Delete the default cube
- Add a plane
- Enter Edit Mode
- Hit 'U' > 'Unwrap'
- Subdivide the plane a couple of times*
- Enter Vertex Paint Mode
- Hit 'T' to bring up the Toolshelf if it isn't already
- Under 'Bake' click 'Bake UV Texture to Vertex Colors'

*The denser the plane/ mesh, the more detail you'll get. (For cool-looking testing purposes, I'd advise to go up to 7 subdivisions ;) )

Event Timeline

I've been hoping for this script in 2.5x for years now, thank you Patrick!

Any Blender developers with trunk/addons commit access, PLEASE consider adding this to trunk, even in contrib/extern addons. This was a KEY feature of 2.49. Thanks to Patrick for reviving this great tool.

Uploaded V0.3.

New features:
- X- and Y-axis Mirroring
- Mapping Modes for vertices who's UV-coordinates were outside the image bounds (Clip, Repeat, Extend)
- Blend Modes (Mix, Add, Subtract, Multiply, Screen, Overlay, Difference, Divide, Darken, Lighten, Hue, Saturation, Value, Color, Soft Light, Linear Light)

Awesome round of additions Patrick! Cant thank you enough for your work to not only revive this functionality in 2.5x, but surpass it in many ways, mirroring, blend modes, etc, WOW!!

Pardon my reiteration, but PLEASE COMMIT THIS TO TRUNK, in addons, addons contrib, extern, whichever. This is core functionality game developers need in Blender, and Patrick has done the hard work of bringing it back to 2.5x. It would be a loss to see such functionality not be maintained in SVN.

Hi,
Just a Reminder for people to Join the Mail List.
If you have not already, please visit this page:
http://lists.blender.org/mailman/listinfo/bf-extensions-cvs
& join the list.

Hi,
Due to changes to the api including the merging of bmesh, several addons are outdated.
Please, if you are the author of an addon check your script with blender revision 44256 or newer.
That is builds made After blender 2.62 official release.
I would ask that updates be made to your addon before the Blender 2.63 release.
6-8 weeks away.
This allows time for the api to become more exposed & bmesh to stablize furthur.
If you need help, drop into irc freenode #blenderpython or #blendercoders & feel welcome to ask questions.
At the time of 2.63 release, scripts that are not repaired or in active developement will have their tracker page marked "Closed"
this will not affect your links to the tracker, similar to closing scripts in 2.49b, the page will be still availible & can be re-opened.

Thanks for your understanding & patience during these Exciting Times.
Brendon.

hi,
Currently I'm still unsure of the working state of this addon.
The addon appears broken to me, marking as broken.
Please let me know if you have the intention of updating.
Thanks for your addon & interest in Blender.
Brendon.

I rewrote bmesh related parts, it now uses loops (please review, dunno if my code is save, i assumed that mesh loop = uv loop = vcol loop)

replaced "for p in pixels: uv_pixels.append(p)" by pixels[:] for even faster execution

tested some simple cases and seems to work again

yipee, bmesh fixes for a Add On I use often. Its essential for vCol baking in realtime game engines. Thank you to Sebastian Nell & CoDEmanX !

Those two, Sebastian and CoDEmanX, is me and they are the very same ^^

Glad this fix is helpful, please post here if you find bugs or need support for multiple textures!

Moved from Py Scripts Upload to Py Scripts Contrib

[canned response]

We gave you bf-extensions rights, read details at:

- http://wiki.blender.org/index.php/Dev:Py/Sharing
- http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons

-----

* You can work on svn in contrib/ directory

See a help panel about svn here:
http://wiki.blender.org/index.php/Dev:Extensions/Sharing/SVN_Help

Don\'t forget to add a meaningful message at each svn commit

The password for svn is the same as the one you use to log in in this tracker.

* We invited you to our commits mailing list
see http://lists.blender.org/mailman/listinfo/bf-extensions-cvs

Please subscribe, so that your commit mail will be sent to
subscribers instead of hanging on
You should have received a mail already about it, if not,
please leave a line here, thx!

* Move your script in contrib/ directory in svn (if it\'s not
there already)

* We are assigning this script to yourself, so that you are
responsible for maintenance.

Please click on "Monitor" to receive updates when people edit
your extension tracker page

* Finally, we have moved this tracker page from the original
location in "Upload", so check the tracker_url field and commit
in bf-extensions

Thanks and welcome aboard! :)

attaching v3 and v4 + diff screenshots for people who wanna see the bmesh changes

Thank you for this script! Just what I needed. Very, very useful for creation of baked vertex lightning from lightmap texture.
Please make this to be included with standard scripts in blender.

...
Also this is a great script example how to work with vcolors/uv in blender. I actually need to write modification which writes values from uv channel in vcolor :). Don't ask me why - the game engine does not support more than 2 uvs, so I intend to export fbx with vcolor values r, g set to values of uv coords read from selected (third) uv layer, and use it later in game shader.

codemanx closed this task as Archived.Nov 25 2012, 1:48 PM

I just moved the script from contrib to trunk, so it will be included in next blender release (2.65).

A game engine supporting 2 UVs? Sounds strange, good look with your workaround!

Yes, it's Unity 3D. You can import only 2 uv channels per mesh... :).
Otherwise, great engine.

This task was automatically closed as archived as part of migration, because it was determined to be no longer active.

The authoritative list of addons is on the wiki, we no longer have a report for each addon to track bugs and updates. Bugs can be reported individually and assigned to the addon developers. See the Addons project page for more information on the workflow.