Announcement

Collapse
No announcement yet.

Help on Vray Nurbs Attribute editor..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help on Vray Nurbs Attribute editor..

    HI
    I know this topic has been touched on before but i'm still finding a few issues that if anyone can help out on it would help me loads.

    1st issue:
    Ok so i need to apply vray Nurbs Attributes to 1000's of surfaces, so i can use this script...

    global proc vrayCreateNurbsAttributes(int $staticGeom, int $tesselationDepth, float $curvatureThreshold) {
    string $selectedNodes[] = `selectedNodes`;
    string $nurbsShapes[];
    int $i, $j = 0;
    for ($i = 0; $i < size($selectedNodes); $i++) {
    string $shapes[] = `listRelatives -shapes $selectedNodes[$i]`;
    for ($iShape = 0; $iShape < size($shapes); $iShape++) {
    string $objType = `objectType $shapes[$iShape]`;
    if ($objType == "nurbsSurface") {
    $nurbsShapes[$j++] = $shapes[$iShape];
    }
    }
    }

    print($nurbsShapes);
    print("\n");

    for ($i = 0; $i < size($nurbsShapes); $i++) {
    string $node = $nurbsShapes[$i];
    if (!`attributeQuery -exists -node $node "vrayAsStaticGeom"`) {
    addAttr -ln "vrayAsStaticGeom" -at "bool" -dv $staticGeom $node;
    }
    if (!`attributeQuery -exists -node $node "vrayMaxSubdivDepth"`) {
    addAttr -ln "vrayMaxSubdivDepth" -at "long" -dv $tesselationDepth $node;
    }
    if (!`attributeQuery -exists -node $node "vrayFlatnessCoef"`) {
    addAttr -ln "vrayFlatnessCoef" -at "float" -dv $curvatureThreshold $node;
    }
    }
    }


    and then to set attributes i might use this one...

    vrayCreateNurbsAttributes(1, 30, 0.5);


    (vrayCreateNurbsAttributes($staticGeom, $tesselationDepth, $curvatureThreshold);

    Where $staticGeom shoudl be True/Faulse 1/0, $tesselationDepth = Max tessellation depth value and $curvatureThreshold = Curvature threshold value.)

    THE problem now is that i cannot find a way of changing the attributes once they are set.

    Does anyone know how i can set them to a higher quality for eg? like this...

    vrayCreateNurbsAttributes(1, 30, 0.2);

    2nd Issue
    I have imported in a load of Nurbs data into a scene and used the import option name clash option to insert BB: before each surface name. It seems that Vray now doesn't recognise this as a Nurbs surface and so i can't apply the Vray Nurbs Attribute!!

    I wish i had realised this earlier as i've done a load of prep work on this data already and don't really want to bin and re-import. If anyone knows how to rename 1000's of surfaces any help would save me some serious grief!!

    thanks to anyone who can lend a hand..

    cheers

  • #2
    Ok i solved the Second issue from this guys web site

    http://edvardtoth.com/extras/mel-scripts/

    check out the massrename script, works a treat...

    Comment


    • #3
      Blackbox: have you tried something like:

      Code:
      //The same code as the vrayCreateNurbsAttributes is using above the two print(...)es.
      
      for ($i = 0; $i < size($nurbsShapes); $i++) {
            string $node = $nurbsShapes[$i];
            setAttr ($node + ".vrayFlatnessCoef") $myValue;
      }
      V-Ray developer

      Comment


      • #4
        Hi t.petrov

        thanks for your reply, it works a treat..

        so the code i used now to surfaces that either have already got Vray Nurbs attributes applied or ones that need it is..

        Code:
        global proc vrayCreateNurbsAttributes(int $staticGeom, int $tesselationDepth, float $curvatureThreshold) {
            string $selectedNodes[] = `selectedNodes`;
            string $nurbsShapes[];
            int $i, $j = 0;
            for ($i = 0; $i < size($selectedNodes); $i++) {
                string $shapes[] = `listRelatives -shapes $selectedNodes[$i]`;
                for ($iShape = 0; $iShape < size($shapes); $iShape++) {
                    string $objType = `objectType $shapes[$iShape]`;
                    if ($objType == "nurbsSurface") {
                        $nurbsShapes[$j++] = $shapes[$iShape];
                    }
                }
            }
        
        for ($i = 0; $i < size($nurbsShapes); $i++) {
              string $node = $nurbsShapes[$i];
              setAttr ($node + ".vrayFlatnessCoef") .6;
              setAttr ($node + ".vrayMaxSubdivDepth") 25;
        }
            
            print($nurbsShapes);
            print("\n");
            
            for ($i = 0; $i < size($nurbsShapes); $i++) {
                string $node = $nurbsShapes[$i];
                if (!`attributeQuery -exists -node $node "vrayAsStaticGeom"`) {
                    addAttr -ln "vrayAsStaticGeom" -at "bool" -dv $staticGeom $node;
                }
                if (!`attributeQuery -exists -node $node "vrayMaxSubdivDepth"`) {
                    addAttr -ln "vrayMaxSubdivDepth" -at "long" -dv $tesselationDepth $node;
                }
                if (!`attributeQuery -exists -node $node "vrayFlatnessCoef"`) {
                    addAttr -ln "vrayFlatnessCoef" -at "float" -dv $curvatureThreshold $node;
                }
            }
        }
        
        vrayCreateNurbsAttributes(1, 25, 0.6);

        I also added to your bit of script the attribute for changing the MaxSubdivDepth.

        My MEL skills are seriously limited if you hadn't noticed but i can't understand why in the last line of the code the settings there seem to be ignored and it's taken from the added script you put in, it doesn't work though if you don't have some values in there!! just curious now..

        thanks again

        Comment


        • #5
          Probably the better thing to do is to declare a separate function, which calls only setAttrs.
          Changing the vray files is dangerous, because if you reinstall vray your changes will be lost.

          If you want to have it in one function it is better to put the for loop with the setAttr calls at the end of the function,
          after the for loop which adds the attributes. Or even better, combine the two loops.
          V-Ray developer

          Comment


          • #6
            Thanks that sounds like the way to go, unfortunately i wouldn't know where to begin..

            I have found though that even adjusting the Vray Nurbs attributes i get really poor quality render of the Nurbs surfaces in scene. Using too high a setting seems to use masses of RAM and it take forever.

            Time is adgainst me with this project so i have to resort to converting the Nurbs data into polys..

            Thanks again for your assistance

            Comment

            Working...
            X