m a y a  m t o r  -  Gumball (Level of Detail)

These images show the results of using the RenderMan Shading Language (RSL) to write a variety of special effects displacement shaders.  
 

 
`

 

Gumball - Displacement Experimentation - In Progress
|__________________________________________________________________________________________________________^back
Goal: Achieve a natural looking gumball seed.
Methods: Use Maya along with renderman shaders to displace a pattern and add texture to a sphere.
To Do: Make more realistic with variation, tapering and texture... - see below continuation with class start.

 

Step 1:
Create a basic repeating pattern from which to work from.

float d = sqrt((ss - scenter) * (ss - scenter) +
(tt - tcenter) * (tt - tcenter));



Click for larger image
Click for larger image
 

Step 2:
Add a line through the pattern to create the pod-like enclosure.  Still need to add smoothing to hump2 (see below).

Shader Code:
float ss = mod(s * s_repeats,1);
float tt = mod(t * t_repeats,1);

float d = sqrt((ss - scenter) * (ss - scenter) +
(tt - tcenter) * (tt - tcenter));

hump1 = smoothstep(rad - blend, rad + blend, d);

if(tt > lineTop && tt < lineBottom) {
hump2 = 1;
}

hump = hump1 * Km1 + hump2 * Km2;

 

Click for larger image


Test #1


  Detailed Gumball Displacement Shader
|___________________________________________________________________________________________________________^top
This still needs considerable work. i need to make the spikes longer and the turbulence of the in between noise a lot more shallow.
 
/* Gumball Shader */
displacement
tgumball(float	Km = 0.1, /* [0 3] displacement magnitude */
				maxcut = .1, 	/*[0 1] width of cut through spike*/
				sc = 0.5,		/* [0 1] center in the s direction*/
				tc = 0.5,		/*center in the s direction*/
				rad = .3,			/* [-1 1] radius of conical bump*/
				srepeats = 8,		/* [0 10] the number of times to repeat bump in s*/
				trepeats = 7,		/* [0 10]the number of times to repeat bump in t*/
				noiseSeed01 = .2,	/* [0 10]the noise for general bumpiness on the seed*/
				noiseSeed02 = 30)	/* [50 100]the noise for the seed bumpiness*/	
{
	float	hump = 0;
	normal	n;
	n = normalize(N);

	float ss = mod(s * srepeats, 1);
	float tt = mod(t * trepeats, 1);
	
/*If the t value is even, then shift to the right
	if  (mod(t/2, 1) < 0.5) {
		tt = mod(t * trepeats, 1);
	} else {
		tt = ((mod(t * trepeats, 1)) + ((mod(t * trepeats, 1)/ 2)) );
	}
*/
/*	Layer 1: Conical bump	*/	
	float d = sqrt((ss - sc) * (ss - sc) + (tt - tc) * (tt - tc));
	float dd = noise(ss * noiseSeed01, tt * noiseSeed01);
	float ddd = noise(ss * noiseSeed02, tt * noiseSeed02);
	float conebump01 = 0;
	
	if ( d < rad ) {
		conebump01 = 1 - smoothstep(0, rad, (d * dd));
	} else {
		conebump01 = (1 - smoothstep(0, (rad + .01) , (d * ddd)));
	}


/*	Layer 2: Subtraction from Conical bump	*/
	d = abs(ss - .5);
	float	cut = smoothstep(0, maxcut, d);
	hump = conebump01 * cut;
	
	
P = P - n * hump * Km;

N = calculatenormal(P);
}
  |___________________________________________________________________________________________________________^top