Yin Yang

An experimental Micro-Film Project. Abstract portrayal of the tension between light & dark.

Reconnect attributes of textures and materials

Reconnect attributes textures and materials

Quick MEL script to quickly re-connect existing texture connections from one slot to another within multiple materials. To use, alter the script to determine the attributes to connect/disconnect, then select multiples materials and run the script.

As defaults, the script is set to get the first input node it can find, its outColor attribute, re-connect it to the material’s ambientColor attribute. Then, it disconnects that input node’s outColor attribute from the material’s color attribute.

It should work, but it’s admittedly a very sketchy script. Well, until I find time to improve it. Cheers!

global proc rf_reconnect(){
    string $sel[] = `ls -sl`;
    for ($item in $sel) {
        string $srccon[] = `listConnections -s 1 -d 0 $item`;
        connectAttr -f ($srccon[0] + ".outColor") ($item + ".ambientColor"); //Create New Connection
        disconnectAttr ($srccon[0] + ".outColor") ($item + ".color"); //Remove Old Connection
    }
}    

rf_reconnect();

Houdini Alembic to Maya with Geometry Separation

One way to export multiple geometries from Houdini to Maya and preserve the geometry separation is to make sure that the primitives have individual @name attributes before using the Merge SOP. Thereafter, ensure that the ROP Alembic Output has ‘Partition Mode’ set to “Use Shape Node Component of Path Attribute Value”, and ‘Partition Attribute’ set to “name”

Update on 14 Sep 2018: You can use a Name SOP to help sort the incoming geometry before the Merge SOP

Ronald Fong Houdini Alembic to Maya Geometry Preservation - ROP Alembic Outpuit Settings

When imported into Maya, Houdini alembic export will show up as a single transform with multiple shape nodes
In Maya, select the transform node and run this script to get unique transform nodes for each shape.

This way, you can do your material assignment like how we’d normally do in Maya, instead of trying to assign them to individual shape nodes. Cheers!

Ronald Fong Houdini Alembic to Maya Geometry Preservation - Shapes to Transforms

//Author: Ronald Fong
//Date: 11 Aug 2018
//Notes: When imported into Maya, Houdini alembic export often show up as a single transform with multiple shape nodes. However, we usually want a transform node per shape node in Maya.
//Usage: In Maya, select the transform node and run this script to get unique transform nodes for each shape. Cheers!

global proc rf_shapesToTransforms() {
    string $abcObj[] = `ls -sl`;
    string $shapes[] = `listRelatives -s $abcObj[0]`;
        for ($shape in $shapes) {
            select $abcObj;
            $newGeo = `duplicate -rr -un -n ($shape+"_GEO")`;
            string $newShapes[] = `listRelatives -s $newGeo`;
            for ($newShape in $newShapes) {
                if ($newShape != $shape) {
                    delete ($newGeo[0] + "|" + $newShape);
                }
                else if ($newShape == $shape){
                    rename ($newGeo[0] + "|" + $newShape) ($newShape+"_GEOShape");
                }
            }
        }
    delete $abcObj[0];
}

rf_shapesToTransforms();

MtoA Arnold for Maya DOF Focus Assist Tool

Hey! I’m an old school CG artist from the days of CPU rendering and depth pass and zDefocus, and only recently got over the psychological barrier of doing in-camera DOF. My conclusion – it’s liberating. Of course, GPU render engines like RedShift is the real deal for this kind of workflow.

But for now, for those who want to give it shot at using Arnold for in-camera DOF, here’s a little script to quickly set up a focus assist locator which you can position as you wish. Just select the camera and run the script to get a focus assist locator. Hope it helps and let me know if you’ve some ideas to improve tool.

A simple tool to have viewport locator feedback for Arnold’s 3D depth of field. You can exactly direct the camera’s focal point in 3D space. It’s easier for me to see and animate this locator than to try animating “distance from camera” value. Hope you find this useful too. Cheers!

Ronald Fong MtoA Maya Arnold DOF Focus Assist Tool Demo 200px

//Author: Ronald Fong
//Date: 09 June 2018
//Usage: Just select your render camera and run the script. Enjoy!

global proc rf_aiDof() {
    string $cam[] = `ls -sl`;
    if (!objExists($cam[0])) {
        print "Ooops! Please select a camera! \n";
        }
    else {
        string $camShape[] = `listRelatives -s $cam[0]`;
        float $camPos[] = `getAttr ($cam[0] + ".translate")`;
        string $locs = `distanceDimension -sp 1 1 1 -ep $camPos[0] $camPos[1] $camPos[2]`;
        connectAttr -f ($locs + ".distance") ($camShape[0] + ".aiFocusDistance");
        setAttr ($camShape[0] + ".aiEnableDOF") 1;
        setAttr ($camShape[0] + ".aiApertureSize") 1;
        setAttr ($camShape[0] + ".aiApertureBlades") 5;
        string $creation[] = `ls -sl`;
        string $camLoc[] = `listRelatives -parent $creation[0]`;
        parent `listRelatives -parent $creation[0]` $cam[0];
        parent $creation[1] $cam[0];
        select -cl;
        print "Success! Position the focus locator as you please! \n";
    }
}

rf_aiDof();

Process

Using Houdini’s FLIP solver to model the Rayleigh–Taylor instability (after Lord Rayleigh and G. I. Taylor). It is an instability of an interface between two fluids of different densities which occurs when the lighter fluid is pushing the heavier fluid.

  • Houdini
  • Redshift

Behind-the-scenes

Most Recent Entries