dPdtime: How the surface position P is changing per unit time, as described by motion blur in the scene.

I have created a dPdtime OSL node for RenderMan rendering with RIS. My worflow includes: Slim, OSL, RIB, TCL, & MEL in cutter. In Maya I have used the RIB box (TCL interpolation) connecting my .TCL file in my project directory. I then used a Mel script generated by my RIB file to create the "Artist Controlled" OSL parameters in the Maya UI. I rendered using RIS and I enabled motion blur (shutter angle: 43) in the render settings. This shader can be used to procedurally visualize magnitude or to "ignore" non moving objects at render time. This technical breakdown explores the possibilities of using dPdtime as tool for FX artists or Look Development artists. I chose to render simple visible colors to display the effectiveness of dPdtime. Photo-realistic renders would not fully illustrate the potential for dPdtime.

dPdtime with Rigid Body Dynamics:

Note: The parameters of the shader are not animated. The "presence" or opacity is controlled by the magnitude of the position of every vertex (dPdtime).

dPdTime.osl Breakdown:

My dPdTime.osl has a motion scale that is a multiple of length(dPdtime). To get the inverse results one can divide. Results 2-7 are parameters of the PxrDisney Bxdf that are also controlled by the "presence" of result1.

shader DpdTime (    
    // parameter vars goes here...
    float motion_scale = 5,
    color baseColor = color(1,0,0),
    color emitColor = color(0,0,0),
    float subsurfaceValue = 0,
    color subsurfaceColor = color(0,0,0),
    float metallic = 0,
    float roughness = 0,
    output float result1 = 0,
    output color result2 = 0,
    output color result3 = 0,
    output float result4 = 0,
    output float result5 = 0,
    output color result6 = 0,
    output float result7 = 0
result1 = length(dPdtime) * motion_scale;
result2 = baseColor;
result3 = emitColor;
result4 = metallic;
result5 = subsurfaceValue;
result6 = subsurfaceColor;
result7 = roughness;

View dPdtime.osl/tcl/.rib/.mel/.oso files

Download dPdtime.osl/.tcl/.rib/.mel/.oso files

dPdtime Motion Scale Parameter:

Below displays the Motion Scale parameter transitioning from: 1, 5, 10, 15, 20, 25, 30. The colored boxes is an experimentation of the parameters. The Maya screenshot displays the parameters of dPdTime shader which include "Artist Controlled" attributes from PxrDisney. Also, I used Nuke to generate a luminance pass.

dPdtime with Motion Capture:

Note: dPdtime may not be ideal to visualize motion capture data due to the strobing intensity of values.

dPdtime OSL/TCL UI:

dPdtime manipulating the Bxdf-PxrDisney shader's: specular, roughness, anisotropic, sheen, and clearcoat:

Note: Boxes in mid-air are white and static boxes are solid red. Previous renders displayed dPdtime controlling the "presence" or opacity of the shape node geometry.

dPdTimeSpecular.rib Breakdown:

I connected the motion_scale ["DpdTimeSpecular13:result1"] to multiple float parameters in the Bxdf "PxrDisney". Also, I typed "reference" before float for each parameter. By doing so, all parameters with ["DpdTimeSpecular13:result1"] will be controlled by the motion_scale of the dPdtime.

Pattern "PxrOSL" "DpdTimeSpecular13" "string shader" "DpdTimeSpecular"
            "float motion_scale" 5
            "color baseColor" [1 0 0]
    Bxdf "PxrDisney" "PxrDisney1"
            "reference color baseColor" ["DpdTimeSpecular13:result2"]
            "color emitColor" [0 0 0]
            "float subsurface" [0]
            "color subsurfaceColor" [0 0 0]
            "float metallic" [0]
            "reference float specular" ["DpdTimeSpecular13:result1"]
            "float specularTint" [0]
            "reference float roughness" ["DpdTimeSpecular13:result1"]
            "reference float anisotropic" ["DpdTimeSpecular13:result1"]
            "reference float sheen" ["DpdTimeSpecular13:result1"]
            "float sheenTint" [0.5]
            "reference float clearcoat" ["DpdTimeSpecular13:result1"]
            "float clearcoatGloss" [1]
            "normal bumpNormal" [0 0 0]
            "int inputAOV" [0]

View dPdTimeSpecular.osl/tcl/.rib/.mel/.oso files

Download dPdTimeSpecular.osl/.tcl/.rib/.mel/.oso files

When the geometry is not moving the following parameters are zero: specular, roughness, anisotropic, sheen, and clearcoat. The values of the parameters fluxuate relative to the magnitude of the geometry. Before the boxes hit the ground the are white and transition to solid red when they stabilize.

Note: (Left to Right) The magnitude of the boxes decrease

dPdtime manipulating the Bxdf-PxrDisney OSL/TCL UI:

Workflow between OSL/TCL/RIB/MEL:

The key to make sure everything works is to set a project directory in Maya. All of your scenes and OSL/TCL/RIB/MEL files should be placed in this directory. Once you create the .osl, you can right click in cutter to generate a .rib. Once the .rib was created, I typed reference and added the results 3-7 to the PxrDisney parameters. Within the .rib, I highlighted everything in the "Pattern" and "Bxdf" then right click to "Export as TCL proc". I saved the .tcl, and pasted the snippet to the "RIBBox" of the lambert shading group. Then, paste the .mel into the script editor with shape node selected. Lastly, in my case I enabled motion blur in the render setting to allow dPdtime to calculate.

# Edit FILENAME so that it matches the name of this TCL document.
# Copy the text to the RIB Box in Maya then remove the comments.
#---- snip ----- snip ---- snip ----
#source [file join $RMSPROJ FILENAME.tcl]
#set rib [lookgen $OBJNAME]
#return $rib
#---- snip ----- snip ---- snip ----

(Above) The snippet to copy from the .tcl to the RIBBox.

View RIBBox + TCL Breakdown on Fundza


This project opened my eyes to the power of OSL (Open Shading Language). At the moment, there is not much flexibility by default with RenderMan. However, the workflow I used in this technical breakdown allowed be to use OSL shaders with connected with RIS PxrDisney shaders. The pxrOSL node does not over any flexibility to control parameters. Using the RIBBox and mel script allowed me to have full control over my shader attributes. I am interested in created more shaders with OSL. Also, dPdtime is usually not used by others in the way I presented it in this breakdown. I am interested in exploring more ways to create procedural shaders.