Simple Paintable CGFX Material For Maya
Sunday, September 18, 2011 6:03:56 AM
This is a simple "paintable" cgfx material for Maya. It interpolates between different material attributes based on vertex colors. So for each vertex color channel, a different material is applied. If all the vertices of a mesh are black, the material corresponding to blackness is applied. If all are red, the material corresponding to red is applied... etc. See the screenshots.
This technique is used frequently in game engines (UDK for example), so this shader can be useful in previewing how an object would look inside the game if it had a similar material setup in the engine. It's also useful for setting the vertex colors from inside Maya in that case, instead of relying on the engine editor's painting capabilities.
Download le shader.
To use the shader:
- Make sure the cgfx shader plugin for Maya is already loaded. It comes with Maya, but it's not auto-loaded by default.
- Assign a new material to your object and select "cgfx shader" for the material type.
- Load the downloaded cgfx file.
- As I still don't know how to set up default values for shader attributes from within the shader code, you need to set up a few attributes in Maya yourself. Start by setting the "Specular Power" attributes to anything other than 0. Also, set the light position to, say, the perspective camera.
- Set the properties for the different materials that correspond to vertex color channels. Set diffuse maps, normal maps, specular maps, specular power and color, and "bumpiness" as desired.
- With the mesh selected, in the Polygons menu set, select Color > Paint Vertex Colors Tool
- Bring up the tool's properties window and set the vertex colors as appropriate. By default, all vertices of a mesh will be white, so the last vertex color component's material will be used.
- Paint away.
If you make improvements or have questions, let me know.
Textures in the screenshot are from nobiax. http://nobiax.deviantart.com/



.









