Sunday, April 22, 2012

Flexible shading on Maya Fur and Hair




Maya's native fur shading doesn't give you much flexibility.  So often times you want to use
another shader but Maya's default fur and hair shaders are hard-coded it
 doesn't let you assign a shader of your choice.
 I'll take a look into what to do to override the default material.
Here's a simple scene with two spheres.
The left one has fur assigned to it and the right one has hair.



 
Here's the render result that looks alright but with a better shader it will look better.


 


In order to override the existing default material you need to add these dynamic attributes.
Select the FurFeedback node and run the following script in the script editor.

addAttr -ln "miExportMaterial" -at bool -defaultValue 1;
addAttr -ln "miMaterial" -at message ;

If we are successful we will get the following in the FurFeedback's tranform node under Extra attributes.


Now, you can assign any shader of your choice. I'll use a p_HairTK shader which you can download for free.
Create a p_HairTK shader and select its shading group node to open Connection edior.



 Now select the FurFeedback and load its tranform node in Connection editor.




 
Make the connection between the shading group node' message to FurFeedback's Mi Material .
Now, you'll see the following in FurFeedback's attribute editor. Make sure you check the option box of Mi Export Material.



 
I repeate the same procedure for the Hair. In this case,  you need to do this on pfxHair's transform node.


Here's the render result.

 

 
Now you can attach any shaders in this manner.
For example, ambient occlusion like below.




2 comments:

  1. thnx thnx thnx thnx thnx thnx thnx thnx :D u solved my big problem

    ReplyDelete
  2. i cant connect the material in the connection editor to the group message node

    ReplyDelete