Renderman Shaders

Non-Photorealistic Rendering

Independent Research by Mayilan Krishnamoorthy

(VSFX 785-02 Prof.Malcolm Kesson)


Paint Effects Shader

Warping technique

One simple but fairly unpredicatable way to produce random splash of color is to use the textture warping technique.

In this technique the shader reads two texture files. The first texture file is used to get the new s and t values based on any of it color channel and use this s and t values to read the second texgture file for color values. This method produces enough random splashes of color to give a paiterly look. The simple code is given below.

 

surface npr_painterly(
           string tex = "M:/vsfx755/texture/paintbrush1.tx";
           string warptex = "M:/vsfx755/texture/paintwarp1.tx";
           )
           {
           Oi = Os;
           float ns = texture( warptex [1],t,s);
           float nt = texture( warptex [2],s,t);
           Ci = texture(tex ,ns,nt);
           }

Examples of some effects achieved by using different images for the texture and warping


Vornoi diffuse

In my first attempts to create a paint daubs like effect, I used the voronoi cells to dettermine the diffuse at all points inside a cell from one point inside the cellr rather than every point. This resulted in the diffuse shading being faceted.

The procedure used below has some flaws in the normal calculation, but works well in most cases.

   #include "M:/vsfx755/rsl_source/noises.h"

   surface npr_voronoidiffuse(
           float	Kd = 1;	/* basic brightness */
           float	Ka = 1;	/* basic brightness */
           float voro_freq = 3;    /* desc {Feature size } */
           float voro_jitter = 0.6;  
           float cell_size = 7;
           string PSpace = "shader"; 
           )
           {
           normal Nn = normalize (-N);
           float dot = Nn . normalize(I);
           point objP = transform (PSpace, P);
           float voro_f1 = 1, voro_f2 = 0;
           point voro_pos1 = 1, voro_pos2 = 0;
           voronoi_f1f2_3d (objP*voro_freq, 
             voro_jitter,voro_f1, voro_pos1, voro_f2,voro_pos2);
           float voro_dist = 1 - smoothstep (voro_f1,voro_f2 
                               , voro_f2 - voro_f1 / cell_size);
           point newP = transform("world",voro_pos1);
           normal newn = (xcomp(newP)-xcomp(E),
                     ycomp(newP)-ycomp(E),zcomp(newP)-zcomp(E));
           newn = normalize(newn);
           color diffusecolor = Kd * diffuse(newn);
           color ambientcolor = Ka * ambient();
           Oi = Os;
           Ci =  (diffusecolor + ambientcolor);
           }

 

Voronoi cells colored by diffuse light
splatter outline with cells colored by light intensity
voronoi cell colored by cell position


Paint shader

By combining the voronoi diffuse and texture warping technique into one shader the following combinations of paint effects were produced.

 
poster color effect using warped brush texture
poster color effect outline
watercolor effect using one underpaint and one overpaint
splatter brush strokes
splatter brush strokes

 

 

mayilan krishnamoorthy mayilan@gmail.com