Monday, May 25, 2009

NATURE MORT

The objective is to create the illusion of decay and rotting written in RenderMan Shading Language, to Maya scene.

These are my picture references






First I modeled a base mesh in Maya then unwrap the polygon so that I can export the obj's files
to Mudbox and sculpt it freely since I need to create multiple displacement maps.



Next step is took the obj's file to Mudbox and began sculpting from firm looking strawberry to rotten one.





I created four color maps due the time constrain but if you have extra time you can create more color maps for more subtle transition.





Then I baked 28 different kind of displacement maps, I've got this good tips from Jon Moore.
Here an example:



To create the displacement shader, the displacement shader was compile with the texture channel shader technique from fundza.com




displacement
Strawberry_Displace(float Km = .0001, /* displacement magnitute */
UseShadingNormals = 1, /* [0 or 1] */
time = 1; /* {0 1] */
string map = "";
output varying float hump = 0)

{
vector diff = normalize(N) - normalize(Ng);
normal n = normalize(N);
float tex;

if(map != "")
{

if(time <= 0.20) hump = mix(1, texture(map[0]), smoothstep(0,0.20,time)); else if(time > 0.20 && time <= 0.4) hump = mix(texture(map[0]), texture(map[1]), smoothstep(0.2,0.4,time)); else if(time > 0.4 && time <= 0.6) hump = mix(texture(map[1]), texture(map[2]), smoothstep(0.4,0.6,time)); else if(time > 0.6 && time <= 0.8) hump = mix(texture(map[2]), 1 - texture(map[3]), smoothstep(0.6,0.8,time)); else if(time > 0.8)
hump = mix(texture(map[3]),
1 - texture(map[4]), smoothstep(0.8,1.0,time));
else if(time > 1.0)
hump = mix(texture(map[4]),
1 - texture(map[5]), smoothstep(1.0,1.2,time));
else if(time > 1.2)
hump = mix(texture(map[5]),
1 - texture(map[6]), smoothstep(1.2,1.4,time));
else if(time > 1.4)
hump = mix(texture(map[6]),
1 - texture(map[7]), smoothstep(1.4,1.6,time));
else if(time > 1.6)
hump = mix(texture(map[7]),
1 - texture(map[8]), smoothstep(1.6,1.8,time));
else if(time > 1.8)
hump = mix(texture(map[8]),
1 - texture(map[9]), smoothstep(1.8,2.0,time));
else if(time > 2.0)
hump = mix(texture(map[9]),
1 - texture(map[10]), smoothstep(2.0,2.2,time));
else if(time > 2.2)
hump = mix(texture(map[10]),
1 - texture(map[11]), smoothstep(2.2,2.4,time));
else if(time > 2.4)
hump = mix(texture(map[11]),
1 - texture(map[12]), smoothstep(2.4,2.6,time));
else if(time > 2.6)
hump = mix(texture(map[12]),
1 - texture(map[13]), smoothstep(2.6,2.8,time));
else if(time > 2.8)
hump = mix(texture(map[13]),
1 - texture(map[14]), smoothstep(2.8,3.0,time));
else if(time > 3.0)
hump = mix(texture(map[14]),
1 - texture(map[15]), smoothstep(3.2,3.4,time));
else if(time > 3.2)
hump = mix(texture(map[15]),
1 - texture(map[16]), smoothstep(3.4,3.6,time));
else if(time > 3.4)
hump = mix(texture(map[16]),
1 - texture(map[17]), smoothstep(3.6,3.8,time));
else if(time > 3.6)
hump = mix(texture(map[17]),
1 - texture(map[18]), smoothstep(3.8,4.0,time));
else if(time > 3.8)
hump = mix(texture(map[18]),
1 - texture(map[19]), smoothstep(4.0,4.2,time));
else if(time > 4.0)
hump = mix(texture(map[19]),
1 - texture(map[20]), smoothstep(4.2,4.4,time));
else if(time > 4.2)
hump = mix(texture(map[20]),
1 - texture(map[21]), smoothstep(4.4,4.6,time));
else if(time > 4.4)
hump = mix(texture(map[21]),
1 - texture(map[22]), smoothstep(4.6,4.8,time));
else if(time > 4.6)
hump = mix(texture(map[22]),
1 - texture(map[23]), smoothstep(4.8,5.0,time));
else if(time > 4.8)
hump = mix(texture(map[23]),
1 - texture(map[24]), smoothstep(5.0,5.2,time));
else if(time > 5.0)
hump = mix(texture(map[24]),
1 - texture(map[25]), smoothstep(5.2,5.4,time));
else if(time > 5.2)
hump = mix(texture(map[25]),
1 - texture(map[26]), smoothstep(5.4,5.6,time));
else if(time > 5.4)
hump = mix(texture(map[26]),
1 - texture(map[27]), smoothstep(5.6,5.8,time));
else if(time > 5.6)
hump = mix(texture(map[27]),
1 - texture(map[28]), smoothstep(5.8,6.0,time));
else if(time > 5.8)
hump = mix(texture(map[28]),
1 - texture(map[29]), smoothstep(6.0,6.2,time));
else if(time > 6.0)
hump = mix(texture(map[29]),
1 - texture(map[30]), smoothstep(6.2,6.4,time));

}

P = P - n * (hump - 0.5) * Km;
if(UseShadingNormals)
N = normalize(calculatenormal(P)) + diff;
else
N = calculatenormal(P);
}





surface
Strawberry_Surface(float Ks = 1,
time = 0;
color hilitecolor = color (0,1,0),
specularcolor = (0,0,0);
string map = "";
color blotch_color = 0;)
{
color surfcolor = 1;
normal n = normalize(N);
normal nf = faceforward(n, I);
float tex;

if(map != "")
{
if(time <= 0.20)
tex = mix(1, texture(map[0]), smoothstep(0,0.20,time));
else if(time > 0.20 && time <= 0.4)
tex = mix(texture(map[0]),
texture(map[1]), smoothstep(0.2,0.4,time));
else if(time > 0.4 && time <= 0.6)
tex = mix(texture(map[1]),
texture(map[2]), smoothstep(0.4,0.6,time));
else if(time > 0.6 && time <= 0.8)
tex = mix(texture(map[2]),
1 - texture(map[3]), smoothstep(0.6,0.8,time));
else if(time > 0.8)
tex = mix(texture(map[3]),
1 - texture(map[4]), smoothstep(0.8,1.0,time));
// composite the texture map color over the background
surfcolor = mix(blotch_color, Cs, tex);
}
Oi = Os;
Ci = Oi * Cs * surfcolor * specularcolor * Ka * Kd * Ks * diffuse(nf);
}



http://www.scribd.com/full/15893735?access_key=key-uewll0wn3yugj8cja7r

Monday, May 4, 2009

MAYA FUR




I unwrap the scalp as flat as possible. So it will make easier once
you put the fur on it.




Once I've done that, I place the scalp inside the head and
scale it down in x,y,z axis.

Applied the fur on the scalp and experimenting with the settings.

Since I unwrap the scalp mesh, I will have extra attribute in U and V sample and
crank it up from 128 to 256 so that I can have more control when I use
direction paint tools attribute.



Here is the result.
I'm not really satisfied with the result because it's to bushy.



Side view.



Three quarter.











Sunday, April 26, 2009

ST COLORATION





surface PacMan_test_2(float Kd = 1,
Ka = 1,
LeftEyeLeftEdge = .1,
LeftEyeRightEdge = 1,
RightEyeLeftEdge = 1.4,
RightEyeRightEdge = 1.6;
color Pink =(1,0,.4);

)
{
color surfcolor = (.5,.5,.5),
pink= Pink;
float LEyeLEdge = LeftEyeLeftEdge,
LEyeREdge = LeftEyeRightEdge,
REyeLEdge = RightEyeLeftEdge,
REyeREdge = RightEyeRightEdge;


/*1st line*/
if(t >= 0.3 && t <= .4 && s >= .8 && s <= 1.2 ) surfcolor = color pink; /*2nd line*/ if(t >= 0.4 && t <= .5 && s >= .6 && s <= 1.4 ) surfcolor = color pink; /*3rd line*/ if(t >= 0.5 && t <= .6 && s >= .5 && s <= 1.5 ) surfcolor = color pink; /*4-6 line*/ if(t >= 0.6 && t <= .7 && s >= .4 && s <= 1.6 ) surfcolor = color pink; if(t >= 0.7 && t <= .8 && s >= .4 && s <= 1.6 ) surfcolor = color pink; if(t >= .8 && t <= .9 && s >= .4 && s <= 1.6 ) surfcolor = color pink; /***4 patch***/ if(t >= 0.6 && t <= .7 && s >= .7 && s <= .9 ) surfcolor = color(1,1,1); if(t >= 0.6 && t <= .7 && s >= 1.3 && s <= 1.5 ) surfcolor = color(1,1,1); /***5 patch***/ if(t >= 0.7 && t <= .8 && s >= .6 && s <= 1 ) surfcolor = color(1,1,1); if(t >= 0.7 && t <= .8 && s >= 1.2 && s <= 1.6 ) surfcolor = color(1,1,1); /***6 patch***/ if(t >= 0.8 && t <= .9 && s >= .6 && s <= .8 ) surfcolor = color(1,1,1); if(t >= 0.8 && t <= .9 && s >= .8 && s <= 1 ) surfcolor = color(0,0,1); if(t >= 0.8 && t <= .9 && s >= 1.2 && s <= 1.4 ) surfcolor = color(1,1,1); if(t >= 0.8 && t <= .9 && s >= REyeLEdge && s <= REyeREdge ) surfcolor = color(0,0,1); /*7-12 line*/ if(t >= .9 && t <= 1 && s >= .3 && s <= 1.7 ) surfcolor = color pink; if(t >= 1 && t <= 1.1 && s >= .3 && s <= 1.7 ) surfcolor = color pink; if(t >= 1.1 && t <= 1.2 && s >= .3 && s <= 1.7 ) surfcolor = color pink; if(t >= 1.2 && t <= 1.3 && s >= .3 && s <= 1.7 ) surfcolor = color pink; if(t >= 1.3 && t <= 1.4 && s >= .3 && s <= 1.7 ) surfcolor = color pink; if(t >= 1.4 && t <= 1.5 && s >= .3 && s <= 1.7 ) surfcolor = color pink; /***7 patch***/ if(t >= .9 && t <= 1 && s >= .6 && s <= .8 ) surfcolor = color(1,1,1); if(t >= .9 && t <= 1 && s >= .8 && s <= 1 ) surfcolor = color(0,0,1); if(t >= .9 && t <= 1 && s >= 1.2 && s <= 1.4 ) surfcolor = color(1,1,1); if(t >= .9 && t <= 1 && s >= 1.4 && s <= 1.6 ) surfcolor = color(0,0,1);

surface diagonal(float Kd = 1)

{
color surfcolor = (.5,.5,.5);


if (s >= 1-t)

{
surfcolor = color(0,0,1);

}//end if

Oi = Os;

Ci = Oi * Cs * surfcolor;
}






surface quadrant(float Kd = 1)

{
color surfcolor = (.5,.5,.5);


if ( (t * t) + (s * s) < surfcolor =" color(0,0,1);" oi =" Os;" ci =" Oi" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIrRTKQcf0BfLOaIFgtHi9AXtJI1wdScr4q17vAyPhMo39LI_nvZi1KgALTktYeTiUqNJo4OBmjH9mBblj6yIMOEYZ8-9rjkLW633cztzD8mVyHpqHJQjbmoqBqy1jnanFF7uLuZqAQxA/s1600-h/cross.jpg">


surface diagonal(float Kd = 1)

{
color surfcolor = (.5,.5,.5);


if ((t > 0.25 && t <> 0.25 && s < surfcolor =" color(0,0,1);" oi =" Os;" ci =" Oi">

Friday, April 24, 2009

LOD




This is the final animation of my cat.



Render with costume lights.

/* Copyrighted Pixar 1989 */
/* From the RenderMan Companion p.339 */
/* Listing 16.7 Distant light source shader */

/*
* pointlight(): provide a ligh with position but no orientation
*/
light
pointlight (

float intensity = 25;
color lightcolor = (0,0,1);
point from = point "camera" (0,0,0) ) /* light position */
{
illuminate (from)
Cl = intensity * lightcolor / (L . L);
}



Because of the poly count (440's) I only able to create short animation.



LOD rib file

AttributeBegin
Detail [-0.5 0.5 -0.5 0.5 -0.5 0.5]

Color 0 1 0
DetailRange [ 1 1 25 100]
ReadArchive "H:/My Documents/vsfx319/ribs/Cat_Low_Res.rib"

Color 1 0 0
DetailRange [25 100 250 500]
ReadArchive "H:/My Documents/vsfx319/ribs/Cat_Medium_Res.rib"

Color 0 0 1
DetailRange [250 500 1000 1000]
ReadArchive "H:/My Documents/vsfx319/ribs/Cat_High_Res.rib"
AttributeEnd

Opacity 0 0 0

Sunday, April 12, 2009

DOF


Playing with magnitude, disp ferq in s and t.



Object feel small.



Object feel huge.



Final composition.




Light Shader:


/* From the RenderMan Companion p.339 */

light
pointlight (
float intensity = 25;
color lightcolor = 1;
point from = point "camera" (0,0,0) )

illuminate (from)
Cl = intensity * lightcolor / (L . L);
}


Displacement Shader:

/*bubbly.sl written a while ago by Ivan DeWolf*/
/*modified by ME 04/11/09*/

displacement
IDbubbly(
float mult = 4,/*multiple bubbles per unit*/
Nzscale = 0,/*scale of the noise ramndomize the location of bubbles*/
Kd = -.2,/*coefficient of displacement*/
bubsize = .25,/*radius of the bubbles*/
Km = 0.05,/*Mangnitude*/
sFreq = 25, /*Displace Freq in s*/
tFreq = 25 /*Displace Freq in t*/
)
{
normal Nn = normalize(N);
float myDisp = sin(s*sFreq*PI) * sin(t*tFreq*PI);
float a,b,c,bub;
float dist, shortest=10000;
point Po = transform("object",P)*mult;


/*true cell center, surrounding cell centers, noised cell center*/
point trucell, surrcell, nzcell;
vector offset;

setxcomp(trucell,floor(xcomp(Po))+.5);
setycomp(trucell,floor(ycomp(Po))+.5);
setzcomp(trucell,floor(zcomp(Po))+.5);

/*what is the shortest distance to a noised cell center*/
for(a = -1; a<= 1; a+=1){ for(b = -1; b<=1; b += 1){ for(c = -1; c<=1; c += 1){ offset = vector(a,b,c); surrcell = trucell+offset; nzcell = surrcell + ((vector cellnoise(surrcell)-.5)*Nzscale); dist = distance(Po,nzcell); if(dist }
}
}
/*where it all happens*/
bub = clamp(shortest,0,bubsize)/bubsize;
P+= Nn*(pow(bub,2)-1) + (myDisp*Kd*Km);
N = calculatenormal(P);

}

Surface Shader 1:

surface
glow2(
float Ks = 1.0,
Ka = 0.8,
Kd = 0.8,
roughness = 0.1;
color myColor = 1;
color specularcolor = 1)
{
normal n = faceforward(normalize(N), I);
vector i = -normalize(I);

float d = n.i;
color y = myColor * 2;
color l = ambient() + diffuse(n);

Oi = 0.8*d;
Ci = Oi*mix(l, y, d);
}


Surface Shader 2:

/*AUTHOR: written by Larry Gritz*/
/*modified by ME 04/11/09*/

#define boxstep(a,b,x) (clamp(((x)-(a))/((b)-(a)),0,1))
#define MINFILTERWIDTH 1.0e-7

surface
LGWallpaper2Stripe (
float Ka = 0.5, /*ambient coefficient*/
Kd = 0.75, /*coefficient of diffuse reflection*/
Ks = 0.25; /*coefficient of specular reflection*/
float roughness = 0.1; /*size of specular highlite*/
color specularcolor = 1; /*specular*/
color stripecolor = color "rgb" (1,0.5,0.5);/*color of background and stripes*/
float stripewidth = 0.25; /*width of stripes, in s coordinates*/
float stripespacing = 0.5; /*dist between sets of stripes, in s coordinates*/
)
{
point Nf;
color Ct;
float stripe, ss;
float swidth;
float W = stripewidth/stripespacing;

/* For antialiasing */
swidth = max (abs(Du(s)*du) + abs(Dv(s)*dv), MINFILTERWIDTH) / stripespacing;

ss = mod (s, stripespacing) / stripespacing - 0.5;

if (swidth >= 1)
stripe = 1 - 20*W;
else stripe = clamp (boxstep(W-swidth,W,ss), max(1-W/swidth,0), 1)
- clamp (boxstep(W+stripewidth,W+stripewidth+swidth,ss), 0, 2*W/swidth)
+ clamp (boxstep(W-swidth+4*stripewidth,W+4*stripewidth,ss), max(1-W/swidth,0), 1)
- clamp (boxstep(W+5*stripewidth,W+5*stripewidth+swidth,ss), 0, 2*W/swidth);

Ct = mix (Cs, stripecolor, stripe);

/* compute shading normal */
Nf = faceforward (normalize(N),I);

/* diffuse reflection model */
Oi = Os;
Ci = Os * ( Ct * (Ka*ambient() + Kd*diffuse(Nf)) +
specularcolor * Ks*specular(Nf,-normalize(I),roughness));
}




Monday, April 6, 2009

Shader 101

This is the final image of my external HD from renderman using
basic shader that was created in cutter and later imported to Maya.


This is the wire frame image from Maya.



I use 3 point lighting to lit the scene. I apply different colors and intensity.



I was doing a little bit of research on glowing shader. I try to tweak the original shader hoping to get the color is changing. Apparently, it does work but it seems the color on the object is changing now. Anyway here's my working .sl file.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/*Original Shader written by Micah Taylor*/

/*Shader tweak by Christian Tjahjono*/

surface
bulb ( float Ks = 1,
Ka = 0.8,
Kd = 0.8,
Ksilh = 0,
roughness = .1,
silhrough = 0.55;

color specularcolor = (0,0,0) )

{
/*surface normal one unit in length*/

normal n = faceforward(normalize(N), I);
vector i = -normalize(I);

/*calculation of the lighting components*/

float d = n.i;
color y = color(1,1.8,7);
color l = ambient() + diffuse(n);

/*calculation of the apparent surface color*/

Oi = 0.3*d;
Ci = Oi*mix(l, y, d);
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


New glowing.sl :

/*Glowing Shader*/


surface glow

(
float Ks = 1.0,
Ka = 0.8,
Kd = 0.8,
roughness = 0.1;
color myColor = 1;
color specularcolor = 1)

{

/* Construct a forward facing surface normal */

normal n = faceforward(normalize(N), I);
vector i = -normalize(I);

/* Calculation for ambient diffuse and color */

float d = n.i;
color y = myColor * 2;
color l = ambient() + diffuse(n);

/* Calculation for the surface color */

Oi = 0.8*d;
Ci = Oi*mix(l, y, d);

}

A test render for the glowing shader .















Monday, March 30, 2009

Matrix Composition

This page demonstrates the basic of scripting shapes directly into RenderMan RIB file. Coding shapes in this way focuses attention on the fundamental concept related to xyz system.


I stared off by creating a sphere object as a reference point.



And I create the following sphere by using the bigger sphere as a path.


I rotate the camera angle to create the rest of the sphere.



Then I scale down the bigger sphere.



Final render



#WorldBegin
AttributeBegin
#Middle big sphere
AttributeBegin
Translate 0 0 0
Sphere 0.2 -0.2 0.2 360
AttributeEnd
#Top center small sphere
AttributeBegin
Translate 0 0.6 0
Sphere 0.075 -0.075 0.075 360
AttributeEnd
#Right small sphere 1
AttributeBegin
Translate 0 0.200 -0.575
Sphere 0.075 -0.075 0.075 360
AttributeEnd
#Right small sphere 2
AttributeBegin
Translate 0 0.375 -0.475
Sphere 0.075 -0.075 0.075 360
AttributeEnd
#Right small sphere 3
AttributeBegin
Translate 0 0.500 -0.350
Sphere 0.075 -0.075 0.075 360
AttributeEnd...