hehe...
try this with any image (don't go over 60x40 pixels!)
50% black (grey) pixels = corridor
black pixels = outdoor space
white pixels = indoor space
if (`window -exists "ImageModelerWindow"` == 1){deleteUI "ImageModelerWindow";}
window -title "ImageModeler" -mnb 0 -mxb 0 ImageModelerWindow;
columnLayout -adjustableColumn 1;
text -l "module dimension= ";
floatField fFMD;
text -l "space height= ";
floatField fFSH;
text -l "";
button -l "Make Building!" -command "Loop()" buildButton;
text -l "";
button -l "delete building" -command "delColumns()" deleteButton;
floatField -e -v 1.0 fFMD;
floatField -e -v 3.0 fFSH;
showWindow ImageModelerWindow;
global float $ModDim;
$ModDim = `floatField -q -v fFMD`;
global int $xRes;
global int $yRes;
$xRes = `getAttr file1.outSizeX`;
$yRes = `getAttr file1.outSizeY`;
print $xRes;
print $yRes;
global proc Loop()
{
global float $ModDim;
$ModDim = `floatField -q -v fFMD`;
global int $xRes;
global int $yRes;
//loop thru all pixels. also avoid neigbor pixels on top or right that don't exist (for loops -1 pixel)
for ($xPixel = 1; $xPixel < $xRes; $xPixel++)
{
for ($yPixel = 2; $yPixel < $yRes + 1; $yPixel++)
{
float $X = ($xPixel/($xRes + .001));
float $Y = ($yPixel/($yRes + .001));
float $XTop = ($xPixel/($xRes + .001));
float $YTop = (($yPixel + 1)/($yRes + .001));
float $XRight = (($xPixel + 1)/($xRes + .001));
float $YRight = ($yPixel/($yRes + .001));
vector $imgColor = `colorAtPoint -o RGB -u $X -v $Y file1`;
vector $imgColorTop = `colorAtPoint -o RGB -u $XTop -v $YTop file1`;
vector $imgColorRight = `colorAtPoint -o RGB -u $XRight -v $YRight file1`;
///////
// MAIN pixel black
if (abs (`mag $imgColor`) <= 0.02)
{
//TOP pixel white
if (abs (`mag $imgColorTop`) >= 1.7)
{
Wall;
move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim - 0.5 * (`floatField -q -v fFMD`));
}
//TOP pixel grey
if (abs ((`mag $imgColorTop`) - (`mag <<0.5,0.5,0.5>>`)) <= 0.04)
{
Wall;
move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim - 0.5 * (`floatField -q -v fFMD`));
}
//RIGHT pixel white
if (abs (`mag $imgColorRight`) >= 1.7)
{
Wall;
move -r ($xPixel * $ModDim + 0.5 * (`floatField -q -v fFMD`)) 0 (-$yPixel * $ModDim);
rotate -r 0 90 0;
}
//RIGHT pixel grey
if (abs ((`mag $imgColorRight`) - (`mag <<0.5,0.5,0.5>>`)) <= 0.04)
{
Wall;
move -r ($xPixel * $ModDim + 0.5 * (`floatField -q -v fFMD`)) 0 (-$yPixel * $ModDim);
rotate -r 0 90 0;
}
}
// MAIN pixel grey
if (abs ((`mag $imgColor`) - (`mag <<0.5,0.5,0.5>>`)) <= 0.04)
{
//TOP pixel black
if (abs (`mag $imgColorTop`) <= 0.02)
{
Wall;
move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim - 0.5 * (`floatField -q -v fFMD`));
}
//TOP pixel white
if (abs (`mag $imgColorTop`) >= 1.7)
{
Column;;
move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim - 0.5 * (`floatField -q -v fFMD`));
}
//RIGHT pixel black
if (abs (`mag $imgColorRight`) <= 0.02)
{
Wall;
move -r ($xPixel * $ModDim + 0.5 * (`floatField -q -v fFMD`)) 0 (-$yPixel * $ModDim);
rotate -r 0 90 0;
}
//RIGHT pixel white
if (abs (`mag $imgColorRight`) >= 1.7)
{
Column;;
move -r ($xPixel * $ModDim + 0.5 * (`floatField -q -v fFMD`)) 0 (-$yPixel * $ModDim);
//rotate -r 0 90 0;
}
}
// MAIN pixel white
if (abs (`mag $imgColor`) >= 1.7)
{
//TOP pixel black
if (abs (`mag $imgColorTop`) <= 0.02)
{
Wall;
move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim - 0.5 * (`floatField -q -v fFMD`));
}
//TOP pixel grey
if (abs ((`mag $imgColorTop`) - (`mag <<0.5,0.5,0.5>>`)) <= 0.04)
{
Column;
move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim - 0.5 * (`floatField -q -v fFMD`));
}
//RIGHT pixel black
if (abs (`mag $imgColorRight`) <= 0.02)
{
Wall;
move -r ($xPixel * $ModDim + 0.5 * (`floatField -q -v fFMD`)) 0 (-$yPixel * $ModDim);
rotate -r 0 90 0;
}
//RIGHT pixel grey
if (abs ((`mag $imgColorRight`) - (`mag <<0.5,0.5,0.5>>`)) <= 0.04)
{
Column;
move -r ($xPixel * $ModDim + 0.5 * (`floatField -q -v fFMD`)) 0 (-$yPixel * $ModDim);
//rotate -r 0 90 0;
}
}
///////
//createFloor;
//move -r ($xPixel * $ModDim) 0 (-$yPixel * $ModDim );
}
}
//end LOOP
}
//////////////////////////////////////////////////////////////////
global proc delColumns()
{
select "Column*";
select -tgl "Wall*";
delete;
}
//////////////////////////////////////////////////////////////////
/*
global proc Column()
{
polyCylinder -r 0.25 -h (`floatField -q -v fFSH`) -sx 12 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1;
move -r 0 ((`floatField -q -v fFSH`)/2) 0;
group;
rename "Column1";
}
*/
global proc Column()
{
polyCube -w 0.4 -h 0.15 -d 0.4 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 1 -ch 1;
group;
rename "Column1";
string $sel[] = `ls -sl`;
move -r 0 .075 0;
polyCube -w 0.4 -h 0.15 -d 0.4 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 1 -ch 1;
parent (`ls -sl`) $sel[0];
move -r 0 ((`floatField -q -v fFSH` + 0.075) - .15) 0;
polyCylinder -r 0.15 -h (`floatField -q -v fFSH`-.3) -sx 6 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1;
move -r 0 ((`floatField -q -v fFSH`)/2) 0;
parent (`ls -sl`) $sel[0];
select $sel[0];
polyUnite -ch 1 $sel[0];
}
//////////////////////////////////////////////////////////////////
global proc Wall()
{
global float $ModDim;
$ModDim = `floatField -q -v fFMD`;
polyCube -w $ModDim -h (`floatField -q -v fFSH`) -d 0.5 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 1 -ch 1;
move -r 0 ((`floatField -q -v fFSH`)/2) 0;
rename "Wall1";
}
//////////////////////////////////////////////////////////////////
global proc createFloor()
{
polyPlane -w (`floatField -q -v fFMD`) -h (`floatField -q -v fFMD`) -sx 1 -sy 1 -ax 0 1 0 -cuv 2 -ch 1;
rename "Floor1";
}