On Mon, Jul 6, 2009 at 05:10, Omar Agudo<omar.ag...@gmail.com> wrote: > > I have tried what you said me but it doesn´t work. I have some questions, > > If you want to render a mesh that have different colors you need to > assign different shaders to the mesh?
There are several ways to do it. That's one way. > Now I do this: > 1) Create the mesh > 2) Assign color per vertex as you told me > 3) Assign the mesh created to the initial shading group ( > cmds.sets(Mymesh, add='initialShadingGroup') ) > > But when I render the image I only achieve render the mesh without > color. I don´t know what I am doing wrong, I have tried also to create > a new shader and assign it to the mesh, but I obtain the same result. Vertex colours are only used by the hardware renderer, for display within Maya. When doing a software render vertex colours are ignored and the mesh's shader determines its colour. I can think of two basic ways of doing what you want to do: 1) Use a separate shader for each unique colour mapping. If every mesh is coloured differently then you'll end up with a separate shader for each one. 2) Write your own shader which uses the vertex colours from the mesh to shade its surface. You might want to ask in the Maya Rendering forum on http://www.highend3d.com if anyone has such a shader that they'd be willing to share with you. Otherwise you're stuck writing your own. > The only way I have found to do what I want to do is to create > diferent shaders (each one with the colors I want to use) and assign > these shaders to the parts of the mesh that have differents colors. > But this solution is too slow, and it requires a lot of time. If the only problem with that solution is that it is too slow to set up, you could write yourself a MEL/Python script, or a plugin command, to automate the task. For example, the script could take the name of a mesh, look at its vertex colours, and then create the necessary shader assignments for you. -- -deane --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---