Digital Lighting: Houdini Tips

return to course


Topics

If you have a tip regarding Houdini tip (esp. lighting or rendering related), let me know! -- Steve May

"PRMan" stands for PhotoRealistic RenderMan.

Using Your Own PRMan Shaders

In a UNIX shell, execute the following (boldface indicates items that you should type):

  1. cd houdini
  2. Make a directory in your houdini directory to store your custom shaders.
    mkdir Shaders
  3. Put a shader into the directory created in step #1 (try this version of the "dented" shader if you don't have a shader) and compile it.
    cd Shaders
    shader dented.sl
    cd ..
    dented:
  4. Make a directory (in you houdini directory) to store the user interface scripts.
    mkdir -p config/Scripts
  5. Create the user interface scripts on all the shaders in your "Shader" directory. This creates a user-interface, dialog script file (e.g. "RMdisplace.ds") for each type of shader in your "Shader" directory.
    rmands -d config/Scripts Shaders/*.slo
  6. So that PRMan finds your shaders, set the "RMAN_SHADERPATH" environment variable to include the directory containing your shaders. RMAN_SHADERPATH is a colon-separated list of directories which is passed to PRMan via the RIB file when the renderer is invoked. You should add (using a text editor) something like the following line to your ".cshrc" file located in the root of your home directory. Note: ACCAD users DO NOT need to do this step. This variable is automatically set in the default environment for Houdini users.
    if ($?HFS) then
      setenv RMAN_SHADERPATH ".:$HOME/houdini/Shaders:$HFS/houdini/ri_shaders:&"
    endif
  7. Start up Houdini. When you select the "cross" button next to Object Op > shading > RMan displacement, you should be able to select the dented shader and modify its only parameter, Km. Then render a scene using PRMan and the surface should have the "dented" displacement shader applied.

Houdini appears to only read these user-interface, dialog scripts (*.ds) the first time they are used (when you select the "cross" button next to the shader value). So, if you create new shaders or add/delete shader parameters, you have to quit houdini and restart. There is probably a way to do this through the textport and scripting commands -- let me know if you figure it out!

Kevin Shepherd (kevin@mad-professor.demon.co.uk) send me this comment regarding the above paragraph. "This is indeed true, However why Houdini does this is due to a set of files and directories in /var/tmp/Dialogs which are generated by rmands the first time you add a shader to your list. Delete the correct file within these directories then bingo you can add diferent parameters by running rmands again."

Communication Between Houdini & PRMan Shaders

When you specify a PRMan surface shader, the only info passed to the shader (by default) is:

When you render with PRMan using the default light source shaders (attenlight, attenspot) you should know the following:

Shadows With PRMan

Creating shadows using the default Houdini RenderMan shaders:

  1. Check (select) Light Op > Shading > Auto-Generate Depth Map;
  2. Supply a shadow map name in Light Op > Shading > Z-Depth Map (use ".tx" as the extension; e.g. "light1.tx").

Remember that for depth maps, the light source must view the parts of the scene that you want that light to cast shadows on. To check this, view the scene from the light source.

Soft shadows. "attenshadow" and "attenshadowspot" have a "width" parameter which can be increased (default = 1) to create soft shadows. However, to set this you have to explicitly set the shader in Light Op > Shading > RMan Shader and this means wiring up all the other controls (light color, cone angle, etc.) or setting them manually.

Shadow Bias. As far as I know, the only way to set shadow bias for PRMan is to set Cam Op > Rendering > Pre-Include to a file which contains the following RIB requests:

Option "shadow" "bias0" [0.15]
Option "shadow" "bias1" [0.3]
Note that these two parameters (default values shown) provide a bias range which is stochastically sampled by the renderer.

Sending Custom Attributes To A Shader

From Mark Elendt, Side Effects:

To send down arbitrary attributes to your shader as RenderMan variables, you can use the Attribute SOP to create a mapping from the Houdini attribute to a RenderMan variable. Then, in your shader, simply declare the attribute in the shader parameters. For example, if you wanted to have a variable specifying temperature of the surface, generate point alpha values using the point SOP. Then, in the attribute SOP, define the mapping:

        Houdini         RenderMan       Type            Offset
        Alpha           Temperature     Vertex Float    0

Then, you can declare the Temperature variable in your shader like:

        surface
        heated(...some parameters...; vertex float Temperature = 0;)


Last updated: 5/13/97
Steve May (smay@cgrg.ohio-state.edu)