Monday, September 5, 2011

ocean solution from Houdini user

http://www.nico-rehberg.de/shader.html#Ptex

Wednesday, October 13, 2010

reflection pass, good to review

If you want to do just a reflection pass
a. create a blinn
b. change the color to black
c. set Eccentricity to 0
d. set Specular Roll off to 1
e. set Specular color to white
f. set Reflectivity to 1

Then add the blinn to the reflective object in a seperate layer. Make sure you have the primary visibility turned off off all the other objects so they dont render and just your reflective object renders. In After Effects or Photoshop or whatever program you composite with you can set the reflective layers blend mode to screen and then control its opacity to get the amount of reflections you want

Sunday, September 26, 2010

maya is a stupid cow when it comes to References files and render shader/layers......fuck!

http://forums.cgsociety.org/archive/index.php/t-588503.html

Thursday, August 5, 2010

Renaming multiple objects in maya+Mel resources

good mel script site
http://www.rodgreen.com/?p=117


in case he delete it one day
///////////////////////////////////////////////


// Copyright (C) 2008 Rod Green
// All rights reserved.
//
// Website: http://www.rodgreen.com

// ---------- Global variables
 global string $pointerObjString = "objectPointerMessage";

// ---------- Utility procedures
 global proc string padInt(int $inputInt, int $length)
 {
  if($length < 1) return "";
  string $returnString = $inputInt;
  for($i = size($returnString); $i < $length; $i++) $returnString = ("0" + $returnString);
  return $returnString;
 }

 global proc string[] getSelection()
 {
  return (ls("-selection", "-long", "-flatten"));
 }

 global proc string renameLong(string $object, string $newName)
 {
  return longNameOf(rename($object, $newName));
 }


 global proc string newTransform(string $name)
 {
  string $transformObj = createNode("-skipSelect", "-name", $name, "transform");
  refresh; // This is needed to finalize the createNode operation to stop the proc from becoming out of sync
  return $transformObj;
 }

 global proc cleanStringArray(string $inputStringArray[])
 {
  string $cleanArray[] = {};
  for($eachItem in $inputStringArray)
  {
   if($eachItem != "") $cleanArray[size($cleanArray)] = $eachItem;
  }

  $inputStringArray = $cleanArray;
 }

 global proc string niceNameOf(string $inputObj)
 {
  return(match("[^|]*$",$inputObj));
 }

 global proc string cullTrailingInts(string $inputString)
 {
  int $intCount = size(match("[0-9]*$", $inputString));

  return (substring($inputString, 1, size($inputString) - $intCount ));

 }

 global proc string adjustString( string $baseString, string $prefix, string $suffix, string $find, string $replace)
 {
  if($find == "") return ($prefix + $baseString + $suffix);
  return ($prefix + substituteAllString($baseString, $find, $replace) + $suffix);
 }


 global proc string[] filterObjectsByTypes(string $objects[], string $types[], int $evalShapeChildren)
 {
  string $returnObjects[] = {};
  if(size($objects) == 0 || size($types) == 0) return $objects;
  for($eachObj in $objects)
  {
   int $matches = 0;
   for($eachType in $types)
   {
    $eachType = strip($eachType);
    if(objectType("-isAType", $eachType, $eachObj))
    {
     $matches = 1;
     break;
    }
    // This loop will be called if the evaluate shape children option is true
    // This way we're able to distinguish a transforms 'shape' type and process as needed
    if($evalShapeChildren)
    {
     string $shapeChildren[] = listRelatives("-fullPath", "-shapes", $eachObj);
     
     for($eachShape in $shapeChildren)
     {
      
      if(objectType("-isAType", $eachType, $eachShape))
      {
       $matches = 1;
       break;
      }       
     }
    }
   }
   if(!$matches) $returnObjects[size($returnObjects)] = $eachObj;
  }
  return $returnObjects;
 }

// ---------- Utility procedures (Object Pointer System)

 global proc int attrSize( string $baseObject, string $attributeName)
 {
  return getAttr("-size", ($baseObject + "." + $attributeName));
 }

 global proc string createObjectPointer()
 {
  global string $pointerObjString;
  string $groupObj = newTransform("__objPointer__");
  addAttr -ln $pointerObjString  -multi -at "message" $groupObj;
  return $groupObj;
 }

 global proc addObjectsToPointer(string $objects[], string $pointer)
 {
  if (size($objects) == 0 || $pointer == "") return;
  global string $pointerObjString;

  for($i = 0; $i < size($objects); $i++)
  {
   connectAttr -f ($objects[$i] + ".message") ($pointer + "." + $pointerObjString + "[" + $i + "]");
  }
 }

 global proc string getObjectFromPointer(string $pointer, int $index)
 {
  global string $pointerObjString;
  $pointer = longNameOf($pointer);
  string $returnObject = "";
  if (!attributeExists($pointerObjString, $pointer)) return $returnObject; // Attribute doesn't exist so return nothing
  string $listConnectionsResult[] = listConnections("-shapes", 1, "-connections", 1,
         ($pointer + "."+ $pointerObjString + "[" + $index + "]"));
  return longNameOf($listConnectionsResult[1]);
 }

 global proc string[] getObjectsFromPointer(string $pointer)
 {
  global string $pointerObjString;
  $pointer = longNameOf($pointer);
   string $returnObjects[] = {};
   if (!attributeExists($pointerObjString, $pointer)) return $returnObjects; // Attribute doesn't exist so return nothing
   int $attrSize = attrSize($pointer, $pointerObjString);

   // Scan attribute for all connected objects
   for($i = 0; $i < $attrSize; $i++)
   {
    string $listConnectionsResult[] = listConnections("-connections", 1,
           ($pointer + "."+ $pointerObjString + "[" + $i + "]"));
   
    if ($listConnectionsResult[0] != "") // Skip blank entries
    {
     $returnObjects[size($returnObjects)] = longNameOf($listConnectionsResult[1]);
    }
   }

   return $returnObjects;
 }


// ---------- Core procedures

 global proc string[] renameObjects( string $objects[], string $newName, string $prefix, string $suffix,
      string $find, string $replace, string $typeMask, int $padding, int $cullTrailingInts)
 {
  
  string $filterTypes[] = {};
  tokenize($typeMask, ",; :/\\|.-", $filterTypes);
  cleanStringArray($filterTypes);
  
  string $filteredObjects[] = $objects;

  $filteredObjects = filterObjectsByTypes($filteredObjects, {"shape"}, 0);

  $filteredObjects = filterObjectsByTypes($filteredObjects, $filterTypes, 1);

  string $pointerObj = createObjectPointer();
  addObjectsToPointer($filteredObjects, $pointerObj);
  string $newNames[] = {};
  string $originalNames[] = {};



  for($i = 0; $i < size($filteredObjects); $i++)
  {

   // Set object names to "__tempName__"
   $originalNames[$i] = niceNameOf($filteredObjects[$i]);
   renameLong(getObjectFromPointer($pointerObj, $i), "__tempName__");

   
   // Establish base name
   string $baseString = $originalNames[$i];
   if($cullTrailingInts) $baseString = cullTrailingInts($baseString);
   if($newName != "") $baseString = $newName;
   int $offsetIndex = 0;


   int $maxLoopCount = size(ls());


   // Generate new name from options
   // If padding is used then loop over name until a unique name is found
   // $maxLoopCount is used to detect a Infinate loop
   string $eachName = (adjustString($baseString, $prefix, $suffix, $find, $replace) 
      + padInt($i, $padding));
   while(objExists($eachName) && $padding > 0)
   {
    $offsetIndex++;
    if ($offsetIndex > $maxLoopCount)
    {
     print ("Attempting to Undo..\n");
     undo();
     delete $pointerObj;
     warning "Renamed failed! - Infinite loop detected!";
     return {};
    }
    $eachName = (adjustString($baseString, $prefix, $suffix, $find, $replace)
      + padInt(($offsetIndex + $i), $padding));
   }

   $newNames[$i] = $eachName;
  }


  // Finally exectue the rename operations
  for($i = 0; $i < size($filteredObjects); $i++)
  {
   string $objectToRename = getObjectFromPointer($pointerObj, $i);
   renameLong($objectToRename, $newNames[$i]);
  }



  string $renamedObjects[] = getObjectsFromPointer($pointerObj);
  

  delete $pointerObj;

  print ("// ----------- Rename details\n");

  for($i = 0; $i < size($filteredObjects); $i++)
  {
   print ("\t" + $filteredObjects[$i] + "\n\t\t-> " + $renamedObjects[$i] + "\n\n");
  }

  print ("// ----------- Success! Renamed " + size($renamedObjects) + " Objects\n");

  return $renamedObjects;

 }

// ---------- UI procedures

 global proc renameObjectsUI()
 {


  global string $renameObjectsWindow;
  if (window("-exists", $renameObjectsWindow)) deleteUI -window $renameObjectsWindow;
  $renameObjectsWindow = window(
      "-widthHeight", 306, 281,
      "-resizeToFitChildren", 1,
      "-sizeable", 1,
      "-title", "Rename Objects Advanced",
      "renameObjectsWindow");
  
   columnLayout;

     rowColumnLayout -width 308 -numberOfRows 9;

         
      string $prefixCtrl = textFieldGrp(
          "-label", "Prefix",
          "-ann", "Prefix to final object names",
          "-cw", 1, 90,
          "-cw", 2, 208,
          "-text", "");

      string $newNameCtrl = textFieldGrp(
          "-label", "New Name",
          "-ann", "Override existing names with this string",
          "-cw", 1, 90,
          "-cw", 2, 208,
          "-text", "");

      string $suffixCtrl = textFieldGrp(
          "-label", "Suffix",
          "-ann", "Suffix to final object names",
          "-cw", 1, 90,
          "-cw", 2, 208,
          "-text", "");
      string $findCtrl = textFieldGrp(
          "-label", "Find",
          "-ann", "String to search for an replace",
          "-cw", 1, 90,
          "-cw", 2, 208,
          "-text", "");
      string $replaceCtrl = textFieldGrp(
          "-label", "Replace",
          "-ann", "What to replace the 'found' string with",
          "-cw", 1, 90,
          "-cw", 2, 208,
          "-text", "");
      string $typeMaskCtrl = textFieldGrp(
          "-label", "Exclude Types",
          "-ann", "Enter types of objects to exclude seperated by commas: i.e. camera, locator",
          "-cw", 1, 90,
          "-cw", 2, 208,
          "-text", "");
      string $paddingCtrl = intFieldGrp(
          "-numberOfFields", 1,
          "-label", "Padding",
          "-ann", "How much to pad integer suffix. 0 relies on Maya's default incrementing",
          "-cw", 1, 90,
          "-cw", 2, 30,
          "-value1", 0);
      string $cullIntsCtrl = checkBoxGrp(
          "-numberOfCheckBoxes", 1,
          "-cw", 1, 90,
          "-value1", 0,
          "-ann", "Delete trailing integers at the end of objects before renaming",
          "-label", "Clean Ints");


     setParent..;



     rowColumnLayout -numberOfColumns 2
     -columnWidth 1 150
     -columnWidth 2 150;

      
      
      button -l "Cancel" -c "deleteUI -window $renameObjectsWindow;";
      button -l "Defaults" -c "renameObjectsUI();"
       -ann "Reset settings to defaults";
     setParent..;

     rowColumnLayout -numberOfColumns 1
     -columnWidth 1 300;

      button -l "Apply (Selection)" -c ( "renameObjects("
           + "getSelection(),"
           + "(\"\" + textFieldGrp(\"-q\", \"-text\", \"" + $newNameCtrl +"\")), "
           + "(\"\" + textFieldGrp(\"-q\", \"-text\", \"" + $prefixCtrl +"\")), "
           + "(\"\" + textFieldGrp(\"-q\", \"-text\", \"" + $suffixCtrl +"\")), "
           + "(\"\" + textFieldGrp(\"-q\", \"-text\", \"" + $findCtrl +"\")), "
           + "(\"\" + textFieldGrp(\"-q\", \"-text\", \"" + $replaceCtrl +"\")), "
           + "(\"\" + textFieldGrp(\"-q\", \"-text\", \"" + $typeMaskCtrl +"\")), "
           + "(intFieldGrp(\"-q\", \"-value1\", \"" + $paddingCtrl + "\")), "
           + "(checkBoxGrp(\"-q\", \"-value1\", \"" + $cullIntsCtrl  + "\"))"
           +");")
           -ann "Do rename!";

     setParent..;
     string $form = formLayout("-numberOfDivisions", 100);
     string $website = text(
        "-width", 300,
        "-enable", false,
        "-font", "smallFixedWidthFont",
        "-bgc", 0.1, 0.2, 0.3,
        "-align", "center",
        "-label", "www.rodgreen.com");

     formLayout -edit
         -attachForm     $website     "top"    -4
     $form;

  showWindow $renameObjectsWindow;

 }


// ---------- Entry

 renameObjectsUI();

MentalRay shader resources: for maya old version(2008,2009)

http://www.pixero.com/downloads_mr.html

Wednesday, August 4, 2010

Mental Ray Alpha Map get Bitchy: notes!

 The only other thing that comes to mind is on the Quality tab, at the bottom under Framebuffer, make sure your Data Type is a type of 'RGBA'. If it is just 'RGB', you won't get the alpha channel.(choose 16bit!!!)


and also, check "Alpha is luminance"....stupid feature.




found some basic along the way, good to have




Maya (and mental ray) both regard Black = 0, White = 1.  When applied to a “Transparency” attribute, 0 = no transparency (opaque) and 1 = full transparency. 
I would make three separate files in Photoshop - one with the picture of the leaf, one with the leaf filled in completely with black and the background completely white, and the third would be a grayscale image of the leaf against a black background.
In Maya, create a file texture node; import the picture of the leaf as the image, and connect it to the color attribute of your shader (I was using a blinn). 
In the hypershade, select the file texture node, select “Edit - Duplicate - Duplicate with connections to the network”.  (Use the “Edit” menu command from the hypershade, not the main menu).  This gives you a new leaf, but it is connected to the same placement node as the original.  Replace the image with the picture of the black leaf against the white background.
Drag this on top of your blinn material, and from the drop-down menu that appears, select “other”.  This brings up the connection editor.  In the left column, find the “color” attribute, and connect that to the “transparency” attribute on the right.  Maya wants to connect alpha or transparency by default- you have to force this connection.
Finally, duplicate this again in the same way, replace the image with the grayscale image, and connect that to the “specular” attribute of the shader.  You can adjust the specular by using the “Color Gain” slider for the image in the attribute editor.

Sunday, January 31, 2010

IQ n clarification of different formats

 Just so I wont forget, note from MB class last year


1)VSK's are made from ROM files( range of motions). These are the smaller X2D files that are easy to recognize since they all have the word ROM in them. (ex. JSN_ROM_001 etc). You fill those and calibrate them, and then export them to VSK's with the same exact Rom Name(ex. JSN_ROM_001.vsk)

2) Game moves, or capture files, are basically every OTHER x2D file we captured with actual game moves on them. These captures are easy to find as well since they all have CAP in the file name, and these x2d's are also much bigger than roms in size. (ex. sh001_cap_001_t001, etc) You label and fill these as well but instead of calibrating and exporting as vsk's, you simply export these as c3D files. (Go to File--> Export and make sure in the c3d option box export unlabeled trajectories is on NO)

Thats pretty much the two file types, VSK's and C3d's that we export from IQ. Some people got confused when we threw the word trials out there. A trial file is just what IQ makes when we work in it. Everything we do in IQ for the most part is in Trial file format, and then saved/exported out in other formats. EVERY time you save an x2d file you are working on IQ creates a trial file with the same name.