2011年1月12日 星期三

PANDA_MASS(Maya Mel)

使用MAYA Mel嘗試使用Mel裡面的Procedure進行繪圖
Procedure就是Mel裡面的Function
此程式參考
zoomy dot net網站中的程式碼
在短時間內可生成多種造形
甚至是動畫生成之造形

Trying to use "Maya Mel" to create form.
The "Procedure" in Mel is as function 
in other programming language.
the CODE is referred from

The Code could create variable forms 
in short period.
It could even create through animation.

利用If_else分配單元之顏色
像是熊貓的主要配色
use if_else condition to decide the color of each component.
The black and white colors are the main characters of PANDA

the code is below:

proc balls(string $u) {
  move -r (rand(-10,10)) (rand(-10,10)) (rand(-10,10)) $u;
  //move -r (rand(-1,1)) (rand(-1,1)) (rand(-1,1)) $u;
  scale (rand(1,3)) (rand(1,3)) (rand(1,3)) $u;
  //rotate -r (rand(1,90)) (rand(1,90)) (rand(1,90));
}

select `polySphere -r (rand(1,20)) -n "pSphere1"`;
//select `polyPlatonicSolid -r 1 -n "pSphere1"`;
//select `polyCube -w (rand(1,10)) -h (rand(1,10)) -d (rand(1,10)) -n "pSphere1"`;

for ($i=0; $i<500; ++$i) {
  $sel = `ls -sl`;
  select `instance $sel`;
  $new = `ls -sl`;
  //setKeyframe -attribute "visibility" -v 0 -t 0 $new;
  //setKeyframe -attribute "visibility" -v 1 -t $i $new;  

  if($i%3==1){
  select -r lambert1;
  setAttr "lambert1.color" -type double3 1 1 1;
  select $new;
  hyperShade -assign lambert1;
  }
  if($i%3==2){
  select -r lambert2;
  setAttr "lambert2.color" -type double3 0 0 0;
  select $new;
  hyperShade -assign lambert2;
  }
  if($i%3==0){
  select -r lambert3;
  setAttr "lambert3.color" -type double3 0.5 0.5 0.5;
  select $new;
  hyperShade -assign lambert3;
  }
  balls($new[0]);
}

The Forms below:








HERE COMES THE PANDA










沒有留言:

張貼留言