## Tuesday, May 18, 2010

### substrate in rsl, version 3

Happy Mistakes. Not what i wanted, but at least it runs and gives me some interesting results.
slbox source

## Monday, May 10, 2010

### Water droplets on surface

Water droplets on leafs.
Its a specular component with displaced shading normal. Some techniques demonstrated here are, 1. adding/modifying displaced shading normal 2. using the shape, and tile node to create the droplets and patterns 3. using shading normal to specify the angle where the droplets would fall away due to gravity.
--------------------------------------------------------------------------------------------------------------------

The tree branch of the specular component of the water droplet, remember, its just a component of the leaf surface.It consists of the spec(cook torrance), reflection, and refraction. None of it ray traced, but requires an hdri environment map, for this example, find a map thats green on the bottom, with cool fill light, and warm key.
--------------------------------------------------------------------------------------------------------------------

First let us define the shape and pattern of the droplet. We'll use a circle shape node, with a fuzz of 4. Connect to a float spline to define the profile of the droplet, as demonstrated on the left. Use a tile manifold node, where we can adjust the frequency and jitter, and under the manifold of tile, lets warp the ST a little to give it a more irregular look.
--------------------------------------------------------------------------------------------------------------------

I also multiply the above with this function, which is that every point thats flat or less than x angle is white, while everything thats steep and greater than x angle is black. Using the dot product between the vector that points in the world y direction and the normal, we get the cosine of the angle.
--------------------------------------------------------------------------------------------------------------------

The key to the droplet is here, we displace the point on surface for this specular component by adding the above to p.
--------------------------------------------------------------------------------------------------------------------
The rest is pretty straightforward, be sure to mask out the droplet on both the refraction and
spec. I also connected "diffuse>colortogray" to the refraction intensity to control the shadow side of the leaf droplet. Otherwise it'll be too bright, on further thought, I probably should do the same to the spec component as a precautionary measure.
--------------------------------------------------------------------------------------------------------------------
Note 1: One problem I have encountered is when the leafs are animated, the angle cut off is too sharp, one possible solution is simply to bake in the position of the droplets into a texture. Anything more complex, for example, droplet falling off the leaf would be better dealt with in FX.
## Tuesday, May 4, 2010

### substrate in rsl, version 2

one main branch to the left, with branching to the right at every point on the main branch. Need to add branching at EVERY iteration.

result = 0; point stspace = point((scale*s)+offset,(scale*(1-t))+offset,0); uniform float i,j; float x[100],y[100],x1[100],y1[100],dx,dy,dx1,dy1,line[100],line1[100],defuzz,newlength,dist,dist1; point p[100],p1[100]; defuzz = 0; //initialize first variables x[0] = vx1; x[1] = vx2; y[0] = vy1; y[1] = vy2; p[0] = point(x[0],y[0],0); p[1] = point(x[1],y[1],0); line[0] = ptlined(p[0],p[1],stspace); j = 0; for (i = 1; i <= 1; i += 1) { newlength = cellnoise(i)/2; dx = x[i]-x[i-1]; dy = y[i]-y[i-1]; dist = sqrt(pow(dx,2)+pow(dy,2)); dx /= dist; dy /= dist; //perpendicular points, left x[i+1] = x[i] - (newlength/2)*dy; y[i+1] = y[i] + (newlength/2)*dx; p[i+1] = point(x[i+1],y[i+1],0); line[i] = ptlined(p[i],p[i+1],stspace); defuzz += 1-smoothstep(width-fuzz,width+fuzz,line[i]); for (j = 1; j <= 5; j += 1) { newlength = cellnoise(j*i)/2; x1[0] = x[i-1]; x1[1] = x[i]; y1[0] = y[i-1]; y1[1] = y[i]; p1[0] = point(x1[0],y1[0],0); p1[1] = point(x1[1],y1[1],0); dx1 = x1[j]-x1[j-1]; dy1 = y1[j]-y1[j-1]; dist1 = sqrt(pow(dx1,2)+pow(dy1,2)); dx1 /= dist1; dy1 /= dist1; //perpendicular points, left x1[j+1] = x1[j] + (newlength/2)*dy1; y1[j+1] = y1[j] - (newlength/2)*dx1; p1[j+1] = point(x1[j+1],y1[j+1],0); line1[j] = ptlined(p1[j],p1[j+1],stspace); defuzz += 1-smoothstep(width-fuzz,width+fuzz,line1[j]); } } result = defuzz;

## Monday, May 3, 2010

### substrate in rsl, version 1

Subscribe to:
Posts (Atom)