Shader Animation - English / Korean

The animation and notes on this page explain how custom shaders written in the RenderMan Shading Language can be animated using SLIM parameter expressions.

Drawing shader

The idea for this project was using Maya dynamic simulation to draw a curve instead of using bezier formula. If I can get UV information from locator in Maya, I could set positions of points in s, t space in renderman shading language, and I can make series of line.

This shader uses one of the functions ( isInLine() ), for the Bezier shader. If I specify 2 point and thickness, the function draws a straight line which is actually a rectangle.

 

First I made a shader that has 100 points x, y information and connected them using isInLine() function and initialized x and y parameters with random values, so it looks like this unless I make any change to the parameters.

 



Then I made this balls simulation in Maya. Also I made a locator that has 2 constrain node. One of the constrain nodes is point constrain that is controlled by the ball position. The other node is geometry constrain that makes locator stick to the surface, so the locator fallows the ball but never goes outside of the surface. Next thing I had to do was to set x, y parameter of the shader. This x, y values are actually s, t values and it should be u, v values in Maya not x, y translation. To get u, v values at the locator position, I used closestPointOnSurface node. There are two useful nodes about point on surface. One is pointOnSurfaceInfo, and the other one is closestPointOnSurface. They return some useful information like position, tangent, uv values or normal. To make these nodes, I have to type “createNode closestPointOnSurface” or “createNode pointOnSurfaceInfo” in script editor, and connect nurbsSurfaceShape.worldspace to inputSurface of these nodes. These nodes do opposite things. For example, in pointOnSurfaceInfo input values are uv and outputs are position or normal, but in closestPointOnSurface position is input and output is uv. In my case, I have locator position and need u, v values, so I connected locator position to closestPointOnSurface.inPosition

I could connect this u,v value directly to shader parameter, and I did so, but since it is not possible to preview a renderman shader in Maya view port, it was hard to expect final result, so I used Maya particle for preview and finally particle points determine the shader parameter values. Maya particle has goalU and goalV, so each particle uses uv values that I got from closestPointOnSurface, and the goalU,V values go to shader parameter.

 

I know it is much easier to make a line if I use renderman line render function… I’ll try to make something useful in the next project.