dPdtime RixPattern/Slim/OSL (Velocity Controlled Shader)




View and Download dPdtime RixPattern(RIS)/Slim(Reyes)/OSL/TCL/MEL on the RenderMan Community Page








What is dPdtime?


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


What does dPdtime do when attached to a shader?


Simply put, this outputs the velocity vector. By keeping track of the velocity per frame, my dPdtime can be used to create stylized renders. I used dPdtime to control the "presence" of the PxrDisney shader. Additonally, I can connect the "result F" of my dPdTime Rix Pattern any float value of any shader. Such as connecting "result F" to the "Subsurface" parameter. Also, I connected the "result F" of my dPdTime node to the mask of a RMSDisplacement Attribute. Therefore, on an animated geometry the shader will fluxuate the values of the parameters relative to the velocity or motion.


What do I need to do to use the RixPattern and Slim node?


To enable this, motion blur in render setting must be turned on and set the "shutter angle" to 1 or more. The threshold of the dPdtime RixPattern can be adjusted using the "Motion Scale" parameter. The dPdtime node can be connected to any float parameter of the PxrDisney or GPSurface: displacement scale, mask, subsurface, metallic, presence, clearcoat, etc. The Slim node can be used by attaching to a GPsurface in Slim with Reyes. The RixPattern must be registered by editing the value of the "nodeid" in the .args file. Custom nodeid numbers must begin at 1053500 or they will be in conflict with nodeid values used by Pixar. For Instructions: fundza.com/cutter/devkit/rixpattern/index.html


Which Operating Systems can use these nodes?


ALL. The Slim node works on all Operating Systems. The RixPattern has a specific plugin for each OS.


What are the .cpp and .args?


RIS relies on the use of shading networks built from components written, not in RSL, but in C++. When used with Maya, RixPattern plugins form "down-stream" shading components that supply values to a material such as PxrDisney. When a plugin is loaded by Maya's HyperShade its corresponding ".args" file is used to define the "look" of user interface.


Other Resources?


Professor Malcolm Kesson at SCAD provided great support through this process. Also, cutter was used to create the nodes. Here is a link to download Cutter. My website with more FX/RenderMan breakdowns: RyanRuiz.com



CutrDpdTime.args:


<!-- CutrDpdTime.args -->
<args format="1.0">
    <shaderType>
        <tag value="pattern"/>
    </shaderType>
    <help>
        dPdTime can be connected to any float value parameter.  
	Motion Blur in Render Settings must be on and have a shutter angle of 1 or more.
    </help>
    
    <!--page name="YOUR_PANEL_LABEL" open="True"-->
        <!-- Inputs begin -->
            <param name="motion_scale" label="Motion Scale" type="float" default="5" input="True" min="0" max="1000" widget="default"/>
        <!-- Inputs end -->
        
    <!--/page-->
    
        <!-- Outputs begin -->
        <output name="resultF"  tag="float|pattern"/>        
        <!-- Outputs end -->
  
    <rfmdata nodeid="1053523" classification="rendernode/RenderMan/pattern"/>
</args>


View CutrDpdTime.cpp

Download CutrDpdTime.cpp & CutrDpdTime.args


Maya RenderMan Linux/Windows/OSX Pipeline:


The dPdtime shader node works on all operating systems and RIS/Reyes. The Slim node will work on both RIS/Reyes without an additional plugin. However, I have included a folder for separate plugins for the RixPattern to work on all operating systems. The first step is to register the .args in the RenderMan_for_Maya.ini . Fundza, provides a great file structure you can download for your custom RenderMan nodes. http://www.fundza.com/rms/customizing/index.html I have customized my Maya.env and userSetup.mel to allow me to switch between RenderMan RixPatterns on Windows and Linux on the same machine. Download my Maya.env and userSetup.mel The CutrDpdTime.args file can be placed in the [/opt/pixar/RenderManStudio-19.0-maya2015/rmantree/lib/RIS/pattern/Args] directory.



Maya.env:


MAYA_USER_DIR=H:/maya
#MAYA_USER_DIR=/home/ryruiz20/mount/stuhome/maya
  
RMS_SCRIPT_PATHS=$MAYA_USER_DIR/projects/RMS_ini
  
# This tells Maya from where to source our personal RMS mel scripts
MAYA_SCRIPT_PATH=$MAYA_USER_DIR/projects/RMS_mel
  
PYTHONPATH=$RMANTREE/bin:$PYTHONPATH
PYTHONPATH=$RMANTREE/lib:$PYTHONPATH
  
MAYA_SHADER_LIBRARY_PATH=$MAYA_USER_DIR/RMS_Collections



Conclusion:


Creating this dPdtime Rix Pattern was a great learning experience. This is my first time utilizing c++ in RIS. Now that the dPdtime tool is created, I now plan on using it for an FX shot for my reel. A firework render may be a great way to show of this shader. Since dPdtime uses velocity, I can use particles in Maya to create an explosion. The faster particles will emit red incandescence and as it slows down (falling from gravity) it will have 0 opacity or presence. Otherwise, I would like to continue to find ways dPdtime can be used for a 3D character to show a stylized effect. Cutter. My website with more FX/RenderMan breakdowns: RyanRuiz.com. Download, test, and review my dPdtime nodes on the dPdtime RenderMan Community Page.


_____________________________________________________________________



dPdtime OSL (rendered with RIS):


Previously, 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.



dPdTime.osl


shader DpdTime (    
    // parameter vars goes here...
    float motion_scale = 5,
  
    output float result1 = 0,
    )
{
result1 = length(dPdtime) * motion_scale;

}

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

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


dPdtime Motion Scale Parameter:

Motion Scale parameter transitioning from: 1, 5, 10, 15, 20, 25, 30.







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.




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

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





(Left to Right): boxes falling, boxes about to stop, boxes are not moving



Workflow between OSL/TCL/RIB/MEL:


The key to make sure everything works is to set a project directory in Maya. 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. View RIBBox + TCL Breakdown on Fundza


# 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.



OSL-RIS Conclusion:


This project opened my eyes to the power of OSL (Open Shading Language). 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.