前回のスクリプトを少し改良して岩・石を自動生成するスクリプトを作ってみる。
基本的な考え方は前回と同じだが、ポリゴンの分割数を変えて最後にスムースをかけることによって、全体がゆがんだ形になるようにしている。
今回の作り方は以下の通り。
まず、1個岩石を作るスクリプトを作ってみる。
global proc makeRock4()
{
string $poly[] = `polySphere -subdivisionsX 5 -subdivisionsY 5`;
float $x = rand(1.0, 2.0);
float $y = rand(1.0, 2.0);
float $z = rand(1.0, 2.0);
scale $x $y $z;
string $ver[] = `polyListComponentConversion -toVertex $poly[0]`;
string $verE[] = `filterExpand -selectionMask 31 $ver`;
for($obj in $verE)
{
$x = rand(-0.2, 0.2);
$y = rand(-0.2, 0.2);
$z = rand(-0.2, 0.2);
select -r $obj;
move -r $x $y $z;
}
string $polyS[] = `listRelatives -shapes $poly[0]`;
polySmooth -divisions 2 -continuity 0.5 $polyS[0];
}
string $poly[] = `polySphere -subdivisionsX 5 -subdivisionsY 5`;
float $x = rand(1.0, 2.0);
float $y = rand(1.0, 2.0);
float $z = rand(1.0, 2.0);
scale $x $y $z;
string $ver[] = `polyListComponentConversion -toVertex $poly[0]`;
string $verE[] = `filterExpand -selectionMask 31 $ver`;
for($obj in $verE)
$x = rand(-0.2, 0.2);
$y = rand(-0.2, 0.2);
$z = rand(-0.2, 0.2);
select -r $obj;
move -r $x $y $z;
string $polyS[] = `listRelatives -shapes $poly[0]`;
polySmooth -divisions 2 -continuity 0.5 $polyS[0];