Bakes the colors of the active UV-Texture to Vertex Colors #28211

Closed
opened 2011-08-10 20:33:25 +02:00 by Patrick Boelens · 24 comments

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 ;) )%%%

**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 ;) )%%%

Changed status to: 'Open'

Changed status to: 'Open'

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.

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.

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

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

%%%Updated the script to V0.2%%%

%%%Updated the script to V0.2%%%

%%%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.%%%

%%%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)%%%
%%%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.%%%

%%%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.%%%
Member

%%%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, 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.%%%
Member

%%%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, 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.%%%
Member

%%%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.%%%

%%%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.%%%
Member

%%%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- [x] for even faster execution

tested some simple cases and seems to work again%%%

%%%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- [x] for even faster execution tested some simple cases and seems to work again%%%
Member

%%%assigned to CoDEmanX%%%

%%%assigned to CoDEmanX%%%

%%%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 !%%%

%%%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 !%%%
Member

%%%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!%%%

%%%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!%%%
Member

%%%Moved from Py Scripts Upload to Py Scripts Contrib%%%

%%%Moved from Py Scripts Upload to Py Scripts Contrib%%%
Member

%%%[canned response]

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


  • 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! :)%%%

%%%[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! :)%%%
Member

%%%updated svn link%%%

%%%updated svn link%%%
Member

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

%%%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. %%%

%%%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. %%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

%%%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!%%%

%%%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.%%%

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

Added subscriber: @jaywat

Added subscriber: @jaywat

Can you believe that Blender 2.8 doesn't support baking to vertex colors? Please we need this plugin working in 2.8. How much donation do I need to give lol, but srsly

Can you believe that Blender 2.8 doesn't support baking to vertex colors? Please we need this plugin working in 2.8. How much donation do I need to give lol, but srsly
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#28211
No description provided.