Kristen Eggleston
  • Demo Reel
  • Contact
  • SESI
  • Explorations in Renderman
  • Mechanical Spiders

Changing Coordinate Space Based on a Null Object

2/15/2013

 
This is for Houdini. It turns out that you can very easily map a shader attribute to a null object's position in reference to a point on the object. You could use this for making frost grow on an object.

Pass in the object's name as a string, "/obj/null1".

Measure the distance from the point to the origin of the null.


         // Makes a point in object space, not
// passed in as (0,0,0) because it is
// automatically converted to object space
point fs = point "object" (0,0,0);

// Transforms the point to null space
fs = transform("/obj/null1", fs);

// Calculates the distance from point to point
float d = distance(fs,transform("shader", P));
Make a ramp based on that distance to change whatever attribute.
        influence = smoothstep(0 + rampSize, radOfInfluence, d);
If you are having difficulties getting the null or whatever object you are using to be recognized by the shader, check the name you are passing in. The easiest way to do this with a null is to check the only default checkbox in the render tab which allows the null to be written to a rib file. Then force the ROP to create a disk file and search the disk file for that string name.

Also note that when entering the name into the field in the shader, double quotes are unnecessary and will break your render. Just enter the name of the object: /obj/null1

Comments are closed.

    Categories

    All
    Accidents
    Cool Tricks
    Houdini
    Shaders

    Archives

    March 2013
    February 2013

    RSS Feed

Proudly powered by Weebly