Maya- Bake Vertex colors to Texture using Mental Ray.

This is a technique to get the Vertex colors from your model baked to a texture using a Mental Ray bakeset.

One method of getting vertex colors from a mesh to a texture is using the Paint Vertex Color tool's 'export' option under 'attribute maps'. This is pretty good for higher poly models, but falls apart on low poly models that might have vertex colors assigned per face rather than per Vert. On these models, the results will look muddy, as there are not enough verts to carry the info.

The other draw back of the Paint Vertex Color tool's export option is that it has no texture padding built in, so whatever colors you get out will be riddled with seams.

I like to use the Mental Ray bake sets to get lighting and color information from Maya to Photoshop. Although it doesn't handle vertex color straight off the shelf, its pretty easy to set it up by making a shader that reads the model's vertex colors.

On left- Sharp details preserved, padding enabled. On right, fuzzville. 
So, to set it up:

  • Make a new material and assign it to your model. I prefer lambert because I'm only after flat color. 
  • In hypershade, make a MentalRayVertexColors node. 

  • Click on the MentalRayVertexColors node. Under cpvSets in the attribute editor, click the button that adds a new item. 
  • Back in the HyperShade, bring up the shading graph of your material, and connect the MeshShape output of your object to the mentalrayVertexColorsNode input. 
  • Find the colorSet->colorSet[0]->colorSet[0].colorName attribute to the cpvSets->cpvSets[0] input.
That one. Over there. 
  • Now, you can use your Mental Ray bake set to bake out your colors by setting it to bake light and color. Did I mention there is padding as well? Well, there is, and its awesome.
  • This also lets you render your vertex colors in the Mental Ray Renderer, which is a cool bonus.  



Your final shading node should look something like this. Mind boggling.  

Model Monkey: Now with Configs!

I've decided to use ini files to make it easier to port my Maya exporter across different projects with as little fuss as possible, using the standard Python ConfigParser module. The last time I really played around with .ini files was to mess with Command and Conquer Red Alert, and that was some time ago. It's really awesome that the .ini file format is still worth using today.

There is a bug where you can add new file rules until the tool grows so long it is
bigger than the screen. Time to add a scroll bar...
Part of getting this to work includes creating a GUI interface to minimize the manual file editing that you might expect. Being my first major use of an .ini for a tool (I did use a teeny tiny .ini on Texture Monkey) I suddenly realized that I had to re-work a lot of my previous configuration code in order to make my tool flexible enough to be re-configurable without breaking into a million different lame parts.

BUT! It's working now, whoo! A couple of things have to be modified, but I can get info into the tool, change it, and get it back into the .ini again, rinse and repeat. In other words, I can now do what people have been doing for decades! Whoo etc. But hey, it works!


Unity4.3 Released

Unity 4.3 has just been released! As a Unity Developer this is awesome news, especially with the new native 2d toolkit that has been included with this release.

The new 2d tools... spritey goodness. 

We have been using the Unikron Software 2d toolkit for all of our sprites in game so far, and it is a pretty well fleshed out package, although a little cumbersome to use. I'm very interested to see how the new native 2d toolkit performs on mobile devices, and if it does perform well, what kind of workflow enhancements it will provide.