\
   

 

     


































home
contents
resume
showreel
portfolio

resources
renderman
maya
massive
houdini

friends
professor malcolm kesson
professor ron bernard
aleksander rodic
andrew dehner
billy dongyoon jang
kiki poh
sandro blattner
zahari dichev

contact
01. 912 . 272 . 2209
davekcw@yahoo.com.sg
Advanced RSL Shaders I - Writing a caustic shader
This project explores the further use of RSL coded shading as a light texture, by exploring the concept of which how Renderman actually processes it renders and how such parameters can be made sharable with data coming from within Maya and even between various different shaders.

Notes!
This project may differ from the initial assignment writeup written for Professor Malcolm Kesson. It would have been edited to also reflect my later experiences, clearer tutorial techniques/codes and also later advancements made to the projects as well.
 
   
Introduction

In this portion of the assignment, we were taught the creation of RSL shaders not for geometry surfaces, but instead light. Messing around with the idea of Normals, Vectors and Procedural Manipulation of mathmatical values in different CG spaces. The first example is the use of the noise parameters to create a projection based caustics.

In theory, caustics are formed via the convex and concave magnification of water as it shifts in density. Thus the idea format of recreating such procedural shaders would be best done using a procedural noise that would closely mimic ocean shaders.

In houdini /max tutorials, the idea concept of ocean shaders comes from displacing a geometry and then pushing it back onto its displacement normals.

 

This concept merely refers to the concentration of the HIs and the LOWs seen in a procedural noise. As the water rises, the distance it bears from the ground increases, thus light becomes more refracted and cocentrated like a magnifying glass. This tells us that the idea of caustics must remain similar as well.

 

In order to refine a beautifully "gradient"ed noise, the idea is to first concentrate it. This technique is simply achieved via the simple graph mathematics using the function of "POWER" in exponentiation.

By simply multiplying the effects of a value by itself, it is simply fast forwarding the value based on its initial sum. A small value will yield a small increment while a large value will grow in greater rates. The best thing? Is that the values, when it comes to normals and vectors of the CG world is that it never becomes more than the value of 1.... since 1 to the power of 1 is 1, it effective limits its value in a suitable range for greater manipulation. The resultant script is show below for greater examinination.

 
 
 

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

Of course, this gradiented shader is not produrally as beautiful as a real caustic due to several factors. Thus, I have somewhat refined it from a fractal like noise to a turbulent like noise by inverting the lower half of the equation...

This is done by subtracting the 0 - 1 extend of the noise script by 0.5, effectively making it a a series of values extending from -0.5 - 0.5. Then by using the absolute(abs) command, we force the negative values into the positive plane which we can then multiply by 2 to restore it to a value of 0 - 1.

This theory is the same as when performing animation curve corrections in procedural key-framing, thereby creating a sharp edge in the near 0 values of the Y axis.

Fortunately, this does not mean that my earlier work is wasted... in face two aspects of my earlier work was found to be extremely valuable.

One being that a noise vector creates a RGB channel which almost looks like a spatial dispersion of light in refract anomallies, and two, the little peaks seen in the before curves could be used to peak the light values of the after... after all, there are obvious differences in certain spots of the caustics where they appear to be much brighter. The comparison and result can be seen below...

 
 
 

With the general light shader completed, it is now set for motion... Sure enough, an object referenced from shader space would observe the ideas of vectors be it XYZ or UVWs. The "Phase" of the noise can be manipulated to create movement. However water itself compresses and expands. While the earlier examples of shader space movements prove to be amusing, it is nowhere close to the exactness of water behaviour.

Fortunately, the same ideal of "space" manipulation can be performed using sin and cos waves. The idea of a sine and cosine math mixed by a square wave of double frequency would create a most exciting wave compression, however, for the sake of keeping things simple, I decided to make use of a sine wave .. for starters. The purpose of the sine wave was of course to displace the surface's position in the "light space" by pushing it forward... and when such sine wave is multiplied by a vector a direction can be specified...

 

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

And a cross axis cosine waves with allows for a diagonal shift of the waves in a more ocean like distortion. This actually creates a mild drifting effect which is subtle but enticing. A following render also displays the significant difference of the caustics from the first version.

 

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


 

And lastly, following the idea of depth manipulation and effects of a magnifying glass, a world space coordinate was introduced to suggest the water surface height and the amount of decay that the light will travel before it blurs out and becomes dark. While a different code was suggested, I decided to follow my intuition instead and creates a lightly different coding seen as

New Power Value = (Abs(Water Height - Current Height)/Max Decay Depth) * Power value

New Light Value = (Abs(Water Height - Current Height)/Max Decay Depth) * Light value

Power ( New Light Value , New Power Value ) This coding deters the blurring contrast effect of a focused lenses.

However, a power of 0 gives odd results, thus logical statements was written to prevent anything below 1...

The result of said depth effect can be seen below.

 

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

   


 
dave kin chang wei - visual effects artist / technical director - davekcw@yahoo.com.sg - www.kamid.net