In the final project, I am working on the digital city concept. Using the GIS map and DEM image to simulate the growth of metropolitan area. The TOPO maps were collected from NASA and satellite image.
The gray color image is the alpha channle. Coloratpoint command will detect the alpha value and use it to control the elevation of each building. |
|
version I: City generator. Displacement value added into Alpha
{ // __________ IMAGE MAPPING _________________________________ // insert the image path in the file node // assign the shader to an object //DisplayShadedAndTextured; // Grab all our texture map samples float $deltaU = ($maxU - $minU)/($nu - 1); // step size in u $currU = $minU; for($i = 0; $i < $nv; $i++) string $listB[]={"building01", "building02", "building03"}; //-----------R value. building A--commercial //-----------B value. building B--residential //-----------G value. building C--45 degree diagonal } } |
This is the first test renderings, The TOPO was made by displacement map. It is not perfectlly matched with the buidling.
|
Version II: City Generator: Displacment value moved into B channel, Rotate value added into Blue channel.
{ // __________ IMAGE MAPPING _________________________________ // insert the image path in the file node // assign the shader to an object //DisplayShadedAndTextured; // Grab all our texture map samples float $deltaU = ($maxU - $minU)/($nu - 1); // step size in u $currU = $minU; for($i = 0; $i < $nv; $i++) string $listB[]={"building01", "building02", "building03"}; //-----------Red value. building A--commercial int $rottime = rand(0,4); //-----------Green value. building B--residential //-----------Blue value. move building along Y axis }
This is a rendering using Blue channel to control the displacment value of terrain buildings' elevation
channels in Photoshop
Displacement in Terrain was added
Four channels in Phtoshop
|
rotatation is based on the alpha value multiply 180 degrees.
Alpha * multiply 360 degrees
Alpha * multiply 180 degrees
city growth
rotate 90 degree for each building
|
Version III: UI created
//this script create terrain based on displacement map //------create terrain--------------------------------------- //-----------create terrain command //create shader group //connect displacement shader node to its shader group //create filenode and link it to displacment shader //connect filenode to displacment shader node //string $dismap = $path2; //create a lambert shader //connect lambert shader node to the exsiting shader group //connectAttr ($filenode2 + ".outColor") ($shader + ".color"); //update the graph network // assign the shader to an object select -r $TOPO[0]; } //---------------delete terrain------------------------------- select -r dis ; } //-------------create city------------- // __________ IMAGE MAPPING _________________________________ // insert the image path in the file node // assign the shader to an object //DisplayShadedAndTextured; // Grab all our texture map samples float $deltaU = ($maxU - $minU)/($nu - 1); // step size in u $currU = $minU; for($i = 0; $i < $nv; $i++) string $listB[]={"building01", "building02", "building03"}; //-----------Red value. building A--commercial int $rottime = rand(0,4); } //-----------Green value. building B--residential //-----------Blue value. move building along Y axis } global proc terraingenerator () //add three values columnLayout; text "input image file";
//----break //three buttons text -l &qu |