|
Maya Blobby Displacement
When moving the blobby shape out of the surface area it is truncated.
I'd like to see the blobby cause the cylinder surface to be attracted
toward the new surface position.
GetMaya Scene
Surface Shader Code
Get Displacement Shader Code
Get Slim Settings
Maya Scene
|
Slim
Surface Shader Settings
pnt = [mattr "nurbsCylinder1.pntD" $F]
 |
Slim Displacment
Shader Settings
pntD = [mattr "nurbsCylinder1.pntD" $F]
 |
Surface Shader Code
/* test shader for color at point "pnt" */
surface
simple_blobby(float Kd = 1,
iso = 0.5,
blur = .05,
rad = 1;
point pnt = 0;
color blobCol = color(0,0,1))
{
/* variables */
normal nf, n;
color diffusecolor, surfcolor = Cs;
point p;
float totalfield = 0, dist;
n = normalize(N);
nf = faceforward(n, I);
Oi = Os;
p = transform("current", pnt);
dist = distance(P, p);
totalfield += 1 - smoothstep(0, rad, dist);
/*
if(totalfield > iso)
surfcolor = color(1, 0, 0);
*/
float blend = smoothstep(iso - blur, iso, totalfield);
surfcolor = mix(Cs,blobCol,blend);
diffusecolor = Kd * diffuse(nf);
Ci = Oi * Cs * surfcolor * diffusecolor;
}
Displacement
Shader Code
/* Displacement blobby shader based on surface position */
displacement
blobbyDisp(float Km = 0.1,/*displacement magnitude*/
radD = 1, /*blobby radius */ isoD = 0.5,
blurD = .05;
point pntD = 0;
)
{
normal n = normalize(N);
float totalfieldD = 0, distD;
float hump = 0;
point pD;
pD = transform("current", pntD);
distD = distance(P, pD);
totalfieldD += 1 - smoothstep(0, radD, distD);
float blend = 1 - smoothstep(isoD - blurD, isoD, totalfieldD);
hump = mix(0, 1, blend);
/* Calculate the surface displacement */
P = P - n * hump * Km;
N = calculatenormal(P);
}
|