david | dj mod,mel script,mentalray,rendering | Sunday, October 14th, 2007

I read a post on Master Zap's blog where he wrote about a problem with mia_material shadows. You can read the full article here. He says "there is a performance issue with the "segment" shadow mode and the mia_material shadow shader" and "The workaround is very simple; don't use the shadow shader for opaque objects".

However when you create a mia_material in maya 2008 it is automatically added as a shadow shader and a photon shader. Rather than having to remember to break the shadow shader connection for each new material, I decided to insert a UI that would allow me to choose what connections to make.

The UI, which pops up when you create a new mia_material, looks like this


The mel script overrides the default maya 2008 behaviour. Just put it in your local scripts folder. Then add the following line to you userSetup.mel

source mrCreateCustomNode.mel;

and restart maya. If you dont like it, just delete it and everything will go back to how it was before.

Download mrCreateCustomNode.rar

UPDATE - 4 Dec 2007

After using this little add-on for a while I got sick of having to click OK every time I created a new mia_material_x. It was so rare that I would change my connection options that I decided it would be better to bypass the prompt and hard-code the connection defaults - which for me is shadow=NO and photon=YES. So I removed mrCreateCustomNode.mel from my local scripts folder and replaced it with a copy of mentalrayCustomNodeClass.mel (D:\Program Files\Autodesk\Maya2008\scripts\others) which I edited to change the defaults.

Near the start of mentalrayCustomNodeClass.mel is a section that relates to mia_material_x and I simply removed the following


Now if I ever need the shadow connection (for transparant shaders for example) I hook it up manually by dragging-and-dropping onto the shadingGroup node in the hypershade window.

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Based on a theme by Roy Tanck