Vray – Mass SubDivision Surface Flag for Maya

 

 

 

 

When you have a lot of objects in a scene and you want to utilize Vray’s subdivision flag, it can be time consuming to go through the whole lot and flag each one by one.

So here’s a quick mel script to help out.

Select all your objects you want flagged as Subdiv and then run this in the script editor:

 

$selected = `ls -sl -l`;

 

for ($i=0;$i < size($selected);$i++)

{

$selShape = `listRelatives -shapes $selected[$i]`;

$selFullPath = ($selected[$i]+”|”+$selShape[0]);

vrayAddAttr $selFullPath vraySubdivEnable;vrayAddAttr $selFullPath vraySubdivUVsAtBorders;vrayAddAttr $selFullPath vraySubdivUVs;

//print ($selFullPath+”\n”);

}

 (Update/Edit : If you find the code throwing you an error like this:

// Error: $selFullPath = ($selected[$i]+”|”+$selShape[0]);

//

// Error: Syntax error // 

You need to change the quote marks ( ”|” ) 

Just select them and retype. You can thank wordpress text formatting for that.)

 

You can then set your globals subdiv to be lower (like 6 instead of 256) and flag the important ones to be higher if needed.

There isn’t a good rule of thumb for how much to subD. It’s based a lot on how close you get to camera and how dense the geo was to start with.

In the event you’re using a displacement map, you’ll want to push this up higher. I find somewhere around the 40-50 gets me where I need  to be without breaking my rendering bank. Again, in the event I need to scrap the paint via camera move I may start pushing this up.  I will however say, I’ve found that a lot of  ”my renders are really slow” come from people flagging the subD on their models and leaving it at default. Again, if 90% of my scene needs a 4-6 subD, I’ll go into the other 10% and give it an override flag, bringing it up to the minimum level to look good.

 

 

2 Responses to “Vray – Mass SubDivision Surface Flag for Maya”

  1. Andrea Molino says:

    This script might be really useful but there’s an error on line 11 that is:

    // Error: $selFullPath = ($selected[$i]+”|”+$selShape[0]);
    //
    // Error: Line 11.31: Syntax error //

    I know little of MEL scripting so i can’t find the error.

    • faust says:

      You need to change the quote marks ( ”|” )

      Just select them and retype. You can thank wordpress text formatting for that.)

Leave a Reply to faust