Difference between revisions of "Create Grid of Spheres with Dedicated Shaders"
From scripting
(Created page with " //Author Nick Pisca 0001d 2009 for ($x=1;$x<10;$x++) { for ($y=1;$y<10;$y++) { string $PSuffix = ($x+"_"+$y); sphere -r 1 -p 0 0 0 -n ("SPH_"+$PSuffix); move -r (...") |
(No difference)
|
Latest revision as of 05:18, 22 April 2017
//Author Nick Pisca 0001d 2009 for ($x=1;$x<10;$x++) { for ($y=1;$y<10;$y++) { string $PSuffix = ($x+"_"+$y); sphere -r 1 -p 0 0 0 -n ("SPH_"+$PSuffix); move -r ($x*2) ($y*2) 0; string $MatPrefix = "BLINN_"; string $CurMat = $MatPrefix + $PSuffix; string $CurMatSG = $MatPrefix + $PSuffix + "SG"; string $CurMatSGsS = $MatPrefix + $PSuffix + "SG.surfaceShader"; string $CurMatoutColor = $MatPrefix + $PSuffix + ".outColor"; shadingNode -asShader blinn -n $CurMat; sets -renderable true -noSurfaceShader true -empty -name $CurMatSG; connectAttr -f $CurMatoutColor $CurMatSGsS; sets -e -forceElement $CurMatSG ("SPH_"+$PSuffix); if ($x==5 && $y==1) { setAttr ($CurMat+".color") -type "double3" 1 1 1; } else { setAttr ($CurMat+".color") -type "double3" 0 0 0; } } }
More information on navigating shader nodes, read pages 133-134 in YSYT.