select -all; delete; defaultDirectionalLight(1, 1,1,1, "0", 0,0,0); float $pnt[], $norm[]; float $u, $v; //string $pl[] = `nurbsPlane -p 0 0 0 -ax 0 1 0 -w 1 -lr 1 -d 3 -u 4 -v 5 -ch 1`; string $pl[] = `nurbsPlane -p 0 0 0 -ax 0 1 0 -w 5 -lr 1 -d 3`; // Get a "master" small sphere that can be instanced string $master[] = `sphere -r 0.09`; global proc vector[] getRandomUVs(int $num) { vector $out[$num]; // Choose a number of random locations for($n = 0; $n < $num; $n++) { $u = rand(0,1); // unlike the points on sphere example $v = rand(0,1); // we do not have sections and spans $pnt = `pointOnSurface -u $u -v $v $pl[0]`; $norm = `pointOnSurface -u $u -v $v -nn $pl[0]`; vector $v = <<$pnt[0],$pnt[1],$pnt[2]>>; $out[$n] = $v; // Distribute small spheres over the surface //sphere -p ($pnt[0]) ($pnt[1]) ($pnt[2]) -r 0.09; /* instance; xform -t ($pnt[0]) ($pnt[1]) ($pnt[2]); */ // or, use these two lines of code //cylinder -axis ($N[0]) ($N[1]) ($N[2]) -p ($pnt[0]) ($pnt[1]) ($pnt[2]) -r 0.001 -hr 1000; //move ($pnt[0]/2) ($pnt[1]/2) ($pnt[2]/2); } return $out; } select -r $master; delete;