Contained in the attached ZIP file is a Blender Python script that can generate vertex colors that approximate a texture image. This can be useful for example for making vertex-color-based shading, by baking shadows or ambient occlusion to a texture, then running this script on it.
Installation
- The numpy package is required for the number crunching. You can find out if you already have that by running python -c "import numpy" on the command line - if nothing happens, you have it, if you get an ImportError, you don't. In the latter case, get it from your package manager or from http://numpy.scipy.org/. I happened to already have it here on Mac OS X, I don't remember whether I had installed it myself or whether it came with the OS.
- Place the unzipped script file in your Blender scripts folder. On Mac OS X and other Unixes that's ~/.blender/scripts; I'm not going to risk a guess where it is on Windows since that seems to be a complicated matter.
- If Blender is running, open a Scripts window and choose Update Menus from the Scripts menu to make the new script show up in the menus.
Usage
Select a UV-mapped mesh object, and open the image you want to approximate in the UV/image editor. Then choose Texture to Vertex Colors from the Mesh > Scripts (or Scripts > Mesh) menu. The script takes a few seconds to run (probably a few minutes for more complex meshes). When it's done, the result has been stored into the selected vertex color layer of the object, or a new one if there wasn't any before. (I have not quite figured out yet what you need to do to make Blender display new vertex colors and/or textures in the textured 3D view. I usually achieve it by randomly fiddling around a bit.) To get satisfactory results, several iterations of tweaking and subdividing the mesh and the UV mapping may be needed. Remember that for PyPRP to use the vertex colors, you need to add a second layer named Alpha (filled with white if you don't use it).
Have fun, and let me know what you think!