Oil Shader & Simulation
A collaborative project with Murat Gonul conceived as a means of creating a realistic oil shader and simulation. We discussed the best means for deriving and implementing a solution and settled on Houdini for the fluid effect simulation due to Murat's extensive background in fluid effects using the program and RenderMan (RSL) for the shaders due to the high quality shaders it can produce.
Programs Used: Houdini
Programming Language(s): RenderMan
Responsibilities: RenderMan Setup and Shader Writing
Houdini at the time had just implemented the use of RenderMan so the setup for its use was rather involved. Murat handled most of the heavy coding and setup of the renderer and render node. He opened the rendermn.ini file to use every available processor. At the time Houdini was set to only use a single thread when rendering a .rib file which was not going to cut it for our processing needs. He further setup the .rib node to use all the available processors customizing the Command to prman -p:(number of processors). In addition the path had to be defined for the shader and textures. The shader path had to include RenderMan's, Houdini's and our custom shader directories. The texture path was set to search our custom textures directory. From the .rib node I had to enable some vital parameters not in its default UI, namely those relevant to transparent objects and substances, Diffuse Trace Depth, Specular Trace Depth and Trace Bias.
Murat created the simulation using Houdini's SPH particle fluid system. He constrained the fluid inside a Rigid Body Dynamics Object, a model of a drinking glass. We were dealing with a viscous fluid so he enabled Viscosity Force and Surface Tension Force. Additionally he increased the Gas Constant to control flow of the fluid from the emitter. Once these parameters were enabled and increased, Murat set the rest density, viscosity and surface tension of the fluid generated as random points from an ellipse emitter. To make the particles move away from the emitter he added some impulse based on the current subframes and increased the birth rate of the particles. Initial velocity direction and variance was then set to make sure the liquid would fall into the glass. The surface of the fluid was generated from metaballs using the Elendt model. Collisions were set to constrain within the glass using collision offset due to the nature of the particles at the center of the metaballs this was essential.
The oil shader is a heavily modified version of the Houdini VEX glass shader. VEX shaders are incompatible with RenderMan, so it had to be reconstructed from scratch using Houdini's RenderMan shader nodes. The outline of how this shader was built can be found in the included pdf file co-authored by Murat and I. An image of the shader network is provided on the last page of the pdf.