CityEngine Experiments, Part 2

Nagakin Style

I modified my version 1 buildings into a sort of modular living unit tower, reminiscent of the Nagakin Capsule Tower by Kisho Kurokawa. (CGA code)

 

 

 

Mapping Density from an Image

/**
 * File:    main.cga
 * Created: 9 Sep 2012 23:37:39 GMT
 * Author:  Chris
 */

version "2011.2"

// Import Lot rules.
import k1 : "kuler.v1.cga"
import k2 : "kuler.v2.cga"

# heightMap attribute is mapped to image.
attr heightMap = 1
const normalBuildingHeightMax = 90
const bumpItUpSome = 6
outlierHeightMultiplier = 90%:1 4%: 2 else: 3

attr buildingHeight = rand(0.4, 1) * (1 - (heightMap * 0.9)) *
 normalBuildingHeightMax * outlierHeightMultiplier + bumpItUpSome

# Send some lots to the version 1 building, the rest to v2.
Lot --> 65%: k1.Lot else: k2.Lot

My first city had buildings ranging randomly in height between 10 and 100 meters. Although the city appeared fine from a bird's eye view, when seen in profile, the city skyline appeared flat (top image, above). To make a more realistic skyline, I used an image map to draw the areas of highest density using a brush in Photoshop (below image). The white areas of the image map create taller buildings (bottom image, above). I also added an outlier multiplier to make a small percentage of the buildings grow 2 to 3 times the average building height.

 

 

 

Object Insertion

livingModule = 
	33%: "models/solid1.obj" 
    33%: "models/solid2.obj" 
    else: "models/solid3.obj"
    
windowOpacityMap = 
	33%: "assets/window1.jpg" 
    33%: "assets/window2.jpg" 
    else: "assets/window3.jpg"

Tile --> 
	extrude(unitDepth)
	i(livingModule)
	color(towerColor)
	set(material.opacitymap, windowOpacityMap)
	setupProjection(0, scope.xz, '1, '1) projectUV(0)
	CullTiles

This example imports random solids into the capsules, and random opacity maps to create windows.

 

 

 

 

 

 

Continue to Part 3: Python Scripting

 

 

CGA Rules for Nagakin Style

/**
 * File:    kuler.v2.cga
 * Created: 9 Sep 2012 13:39:46 GMT
 * Author:  Chris Wilkins
 */

version "2011.2"

import colors : "colors.cga"
mainColor = colors.mainColor
towerColor = colors.towerColor

attr groundFloorHeight = 4
attr floorHeight = 3
attr roofFloorHeight = 0.1
attr tileWidth = 3
attr buildingHeight = -1
attr minFootprintArea = 10
attr unitDepth = rand(3,6)
const floorThickness = 0.25 

@StartRule
Lot -->	convexify()	innerRect() comp(f) {all:SubLots}

SubLots --> # Cull small lots.
	case geometry.area <= minFootprintArea:	NIL
	else: Footprint

Footprint --> offset(-1 * unitDepth) comp(f) { inside: CoreFootprint }

CoreFootprint --> 
	# Correction for sloped lots, from NYC 2259 example project.
	s('0.9,'1,'0.9) center(xz) alignScopeToAxes(y) s('1,0,'1)
	extrude( buildingHeight)
	Mass

Mass -->
	split(y) { groundFloorHeight : GroundFloor
			 | {~floorHeight : Floor}*
			 | {roofFloorHeight : Roof}}

Roof --> comp(f) { side : Roof2}
Roof2 --> split(x) {0.5: NIL | 0.5 : RoofCorner | 
	{~tileWidth : Roof3}* | 0.5: RoofCorner | 0.5 : NIL}
Roof3 --> extrude(unitDepth + 1) translate(rel,world,0,floorHeight,0) 
	r(-1 * rand(5,20), 0, 0) color(mainColor)

RoofCorner -->  extrude(-0.5) comp(f) {world.up: RoofCorner2}
RoofCorner2 --> extrude(4) s('0.5,'1,'1) center(xz) color(mainColor)

GroundFloor --> comp(f) { side : GroundFloor2}
GroundFloor2 --> color(mainColor)

Floor --> 
 	comp(f) { side : Facade Facade2}
 	comp(f) { world.down : Core}

Core --> offset(-0.1) comp(f) { inside: Core2 }
Core2 --> offset(-2.5) comp(f) { border: Core3 }
Core3 --> color(mainColor) extrude(floorThickness)

Facade --> split(x) {1 : Corner | {~tileWidth : Tile}* | 1: NIL }
Facade2 --> split(y) {2 : NIL | 1: Girder}

Girder --> split(x) {1 : NIL | {1000: Girder2}* | 1: NIL }
Girder2 --> color(mainColor) extrude(-0.4) translate(rel, world, 0, -1 * floorThickness, 0)

Corner --> extrude(-1) color(mainColor) 

livingModule = 33%: "models/solid1.obj" 33%: "models/solid2.obj" else: "models/solid3.obj"
windowOpacityMap = 33%: "assets/window1.jpg" 33%: "assets/window2.jpg" else: "assets/window3.jpg"

Tile --> 
	extrude(unitDepth)
	i(livingModule)
	color(towerColor)
	set(material.opacitymap, windowOpacityMap)
	setupProjection(0, scope.xz, '1, '1) projectUV(0)
	CullTiles
	
CullTiles -->
	50%: NIL
	else: CulledTile