gumball project


These images show the results of using Maya and MTOR to create an animation of instanced geometry where LOD (level of detail) is used to blend between high polygon and low polygon versions of the object, based on its distance size relative to the screen resolution.



RSL ambient occlusion shader code:

 

surface gum_occlude(float samples = 32,
maxdist = 100000,
roughness = 0.1,
Ks = 0.6;
color hilitecolor = 1)
{
normal i = normalize(I),
n = normalize(N),
nf = faceforward(n, i);
float occ = occlusion(P, nf, samples,
"maxdist", maxdist);

Oi = Os;
Ci = (1 - occ) * Cs * Oi;

/* Add some specularity */
i = normalize(-I);
color speccolor = Ks * specular(nf, i, roughness) * hilitecolor;
Ci = Ci + speccolor;
}

 

 

 

 

 

Rendered with MTOR using an ambient occlusion RSL shader

Rendered in Mental Ray with an ambient occlusion shader



 

High resolution gumball model

13628 polygons
.mb file = 1264 KB
.ma file = 1826 KB

Mid resolution gumball model

3364 polygons
.mb file = 427 KB
.ma file = 731 KB

Low resolution gumball model

306 polygons
.mb file = 87 KB
.ma file = 179 KB

 

 

 

 

 

 

 


Render showing LOD transition from the low res to high res model

 

RIB BOX

 

AttributeBegin
Detail -1 1 -1 1 -1 1

Color 1 0 0
DetailRange \[5000 10000 30000 4000000\]
ReadArchive "H:/rman/archives/gumball_hires.rib"

Color 0 1 0
DetailRange \[200 1000 5000 15000\]
ReadArchive "H:/rman/archives/gumball_midres.rib"

Color 0 0 1
DetailRange \[0 50 200 1000\]
ReadArchive "H:/rman/archives/gumball_lowres.rib"
AttributeEnd

Opacity 0 0 0


 

RIB BOX

AttributeBegin
Detail -1 1 -1 1 -1 1

#Color 1 0 0
DetailRange \[5000 10000 30000 4000000\]
ReadArchive "H:/rman/archives/gumball_hires.rib"

#Color 0 1 0
DetailRange \[200 1000 5000 15000\]
ReadArchive "H:/rman/archives/gumball_midres.rib"

#Color 0 0 1
DetailRange \[0 50 200 1000\]
ReadArchive "H:/rman/archives/gumball_lowres.rib"
AttributeEnd

Opacity 0 0 0


 

 

Procedural RSL gumball displacement shader

/* calculate the sub-spaces using mod() */

float ss = mod(s * srepeats, 1), tt = mod(t * trepeats, 1);

 

/* Layer 1: find the distance from the center of the base of the bump
and then use smoothstep to create the conical bump */
float d = sqrt((ss-sc)*(ss-sc) + (tt-tc)*(tt-tc));
float dd = noise(s * 0, t * 0);
float conebump = 1 - smoothstep(0, rad, d * dd);

 

/* Layer 2: find the distance from the midline in the s direction, then
use it to define the profile of the "cut" */
d = abs(ss - 0.5);
float cut = smoothstep(0, maxcut, d);

 

/* Layer 3: combine the tweo operations */
hump = conebump * cut;

 

float dd = noise(s * 25, t * 30 * 0.5) * 2.9 - 0.3

ss = mod(ss + offstep * noise (s,t) , 1);
tt = mod(tt + offstep * noise (s,t) , 1);
if (mod (row, 3) == 0 || mod (col, 3 ) == 0){

ss += noise (s,t)/5;
tt += noise (s,t)/5;