Personal Project

 Finished Animation

Description

The second scene of my thesis project will consist of a bulding covered with procedural texture, and will also show the process of the texture transforming and animating.

Here’s a link to an introduction of my thesis project:

Using Visual Effects as a Digital Creative Tool for Contemporary Artist - Ziye Liu

Reference Image

Color dots on various sets of objects, from artist Yayoi Kusama’s Polka Dots.

003
dots-obsession-full


Technical Breakdown

Besides some basic RenderMan Shading Language (RSL), texture bombing is also used in order to create such a customize pattern.

Please refer to this article for more description about texture bombing, this is the major technical reference of this project.

Texture bombing is a technique being used to distrubute large amount of texture maps across a surface. Using reference materials I have found, I declared functions involved with the calculation, then save these functions as a separated .h header file to use them inside the slim template. By changing the value of randomness seed within a For Loop, the user will have the ability to control the distance, radius and color variation of the pattern distrubution. 

A simple RSL function with multiple input was declared to create the color dots:

#define circle(r, fuzz, ss, tt) \
1-smoothstep(r-fuzz, r+fuzz, sqrt((ss-0.5)*(ss-0.5)+(tt-0.5)*(tt-0.5)))


Some mathmatic functions were declared and save into the seperated .h file:

#define pulse2(a,b,fuzz,x) (smoothstep((a)-(fuzz),(a),(x)) - \
               smoothstep((b)-(fuzz),(b),(x)))
  
#define boxstep2(a,b,x)    clamp(((x) - (a))/((b) - (a)), 0, 1)
  
#define repeat2(x,freq)    (mod((x) * (freq), 1.0))
  
#define odd2(x)            (mod((x), 2) == 1)
#define even2(x)           (mod((x), 2) == 0)
  
#define whichtile2(x,freq) (floor((x) * (freq)))


Import the .h file into the customized .slim template:

RSLInclude "[yourpath]/custom.h"


At the moment, the path to this .h file is an absolute path. After the shader is being complied into .slo file, it won't need the .h file anymore.

Problems Encountered 

When the customized slim pallete is loaded into Slim editor, it might report error that some functions can’t be declare because they already exists. This could be easily solved by renaming your customized functions within the .h file, if there’s no duplicated names, the shader will compile succesfully.

slimpalt

The custom bombing shader node, using different settings to get different result

The custom bombing shader will then be connected to other shading nodes, the output is then converted to diffuse, bump and specular map. Also, the radius of dots can be control by other inputs such as a turbulance noise.

shadingnetwork

The shading network

Keyframe Animation

After the shading network is all set, in order to add keyframe or expression animation to the shader’s parameters, some parameters are converted to use external value.

externalvalue

This enables the ability to publish the parameter into Maya’s Attribute Editor. Then these parameters can be animated using an animation curve or an expression. 

attributeeditor2

To test the shader’s render result, one of a convinient way to do is using RenderMan’s Re-Rendering mode.

re-rendering

So the renderer will do a continuously realtime render, which is ideal for shader and lighitng testing purpose. Here’re some test animation:

pattern1

S & T Offset

pattern2

Radius, S & T Offset

pattern3

Radius based on turbulance noise

pattern4

Radius based on turbulance noise and clamping


Issue with Render Farm

The render farm can handle RenderMan scene with customized shader, however I have encounterd some difficulties rendering animated shader on the node-based render farm.

The issue is, based on the way the render farm distributes its render jobs, it uses single frame command-line render such as:

[path_to_maya]/bin/Render -renderer rman -s 1 -e 1 -proj [project path] -rd [new render folder path] [maya scene file path]

Notice the parameters -s 1-e 1 actually means the render will starts on frame 1 and ends on frame 1. It will do the same on each frame for the rest of the sequence, such as -s 48 -e 48, or -s 90 -e 90. These commands are distrubuted to each render nodes.

But this leads to a problem with RenderMan Shader, since the shader wouldn’t be updating during these seprated, single frame command-line renders. Instead, it will keep rendering the shader as if it’s at the first frame. 

This has been test with animation curve, expression, baked animation, even with image sequence as texture map, none of these work with single frame command-line render. 

Unless the command line render was specified to do a multi frame render, such as -s 1 -e 100, it will just ignore the shader’s animation. 

Currently I have no solution to this issue. The only way is to render this locally, either by using batch render, or multi frame command-line render.

Conclusion

The ability to customize a slim palette is very powerful when the artist is dealing with procedural shaders. By using shading language knowledge, I was able to successfully create what I intended to do with RenderMan. However the shader is not perfect, and there much more function to be added in the future. I’ll keep updating this project as it will become part of my thesis project.

© Ziye Liu 2014