// create the file node and shader select -all; delete; string $file = `createNode file`; string $shader = `createNode lambert`; string $path = "/Users/malcolmkesson/Documents/path2.jpg"; // connect the nodes connectAttr ($file+".outColor") ($shader+".color"); // insert the image path in the file node string $roadMap = $path; setAttr -type "string" ($file+".fileTextureName") $roadMap; // assign the shader to an object string $object[] = `nurbsPlane -ax 0 1 0 -name "nurbsPlane1"`; //select -r $object[0]; //hyperShade -assign $shader; //DisplayShadedAndTextured; int $u, $v, $nu = 100, $nv = 100; float $minU = 0.03, $minV = 0.03, $maxU = 0.92, $maxV = 0.92; float $out[] = `colorAtPoint -o RGB -su $nu -sv $nv -mu $minU -mv $minV -xu $maxU -xv $maxV $file`; float $deltaU = ($maxU - $minU)/($nu - 1); float $deltaV = ($maxV - $minV)/($nv - 1); float $currU, $currV; int $index = 0; $currU = $minU; //string $marker[] = `sphere -r 0.005`; for($n = 0; $n < $nu; $n++) { $currU += $deltaU; $currV = $minV; for($i = 0; $i < $nv; $i++) { float $r = $out[$index]; float $g = $out[$index + 1]; float $b = $out[$index + 2]; float $rgb = $r + $g + $b; // print($index + " " + $r + " " + $g + " " + $b + " " + $rgb + "\n"); if( ($r + $g + $b) < 0.3) { float $p[] = `pointOnSurface -u $currU -v $currV $object[0]`; vector $v1 = rand(-0.01, 0.01); vector $v2 = rand(-0.01, 0.01); vector $v3 = rand(-0.01, 0.01); /* curve -d 1 -p $p[0] $p[1] $p[2] -p $p[0] ($p[1] + 0.1) $p[2] -p $p[0] ($p[1] + 0.2) $p[2] -p $p[0] ($p[1] + 0.3) $p[2]; */ curve -d 3 -p $p[0] $p[1] $p[2] -p ($p[0] + $v1.x) ($p[1] + 0.02) ($p[2] + $v1.z) -p ($p[0] + $v2.x) ($p[1] + 0.04) ($p[2] + $v2.z) //-p ($p[0] + $v3.x) ($p[1] + 0.08) ($p[2] + $v3.z) -p ($p[0] + $v3.x) ($p[1] + 0.1) ($p[2] + $v3.z); //string $shape[] = `listRelatives -s`; //addAttr -ln mtorCurveWidth -dv 0.001 -k true $shape[0]; } $index += 3; $currV += $deltaV; } } defaultDirectionalLight(1, 1,1,1, "0", 0,0,0); select "curve*"; //displaySmoothness -pw 3;