Context Free Art

Tutorials/3D Cubes

From Context Free Art

Jump to: navigation, search

Think about a box.

rule CUBE {2*{s -1 1}SIDE{}TOP{}}
 
rule SIDE {FACE{skew 0 30}}
 
rule TOP {FACE[s 1.413 .816 r 135]}
 
rule FACE {SQUARE{x .5 y -.5 a -.75}}

(The code above was gracefully submitted to the community by Guigui.)

Here it is:

Image:Box.jpg

How about making a few more?

rule cubes {
CUBE { }
cubes { z -1 s .99 x 1 y .58 }
}
rule cubes {
CUBE { }
cubes { s 1.01 z 1 y 1 }
}

Image:Boxes.jpg

Although apparent only to close inspection, the boxes above increase slightly in size as they are piled on top of each other, and decrease in size when placed sideways "further away" from the viewer.

Let's make some towers!

rule cubes {
CUBE { }
cubes { s 1.01 z 1 y 1 }
}
rule cubes .1 { }
 
rule towers {
 10* { x 2 y .2 z -1} cubes { } }

Image:Towerscfdg.jpg

This is actually pretty lame, but there's an idea.

Ok, let's make some really bloated towers.

startshape towers
 
rule CUBE {2*{s -1 1 b .3}SIDE{}TOP{}}
 
rule SIDE {FACE{skew 0 30 b .5}}
 
rule TOP {FACE[s 1.413 .816 r 135 b .9]}
 
rule FACE {SQUARE{x .5 y -.5 }}
 
 
rule cubes {
   CUBE { }
   cubes { s 1.01 z 1 y 1 }
   spread { } }
rule cubes .3 { }
 
rule spread {
   cubes { s 0.99 z -1 x 1 y .58 }
   cubes { s 0.99 z -1 x -1 y .58 } }
rule spread {
   cubes { s 1.01 z 1 x 1 y -.58 }
   cubes { s 1.01 z 1 x -1 y -.58 } }
rule spread 15 { } 
 
rule towers {
 10* { x 2 y .2 z -1 r -3} cubes { } }

Now we are getting there.. er, somewhere... Notice how the slight rotation of the pillars ( rule towers ) makes for a new kind of perspectival effect.

Image:Towerscfdg2.jpg

Views
Personal tools
Navigation
Toolbox
MediaWiki
Attribution-Share Alike 2.5
book coverSee our book:
Community of Variation