CARTOONY BUILDING RULE?

4097
6
Jump to solution
04-02-2015 01:27 PM
ErwinVervacke
New Contributor III

Would it be possible (and how) to generate building models that have an overhanging roof with thickness and that have rounded vertical edges at the facade?  See picture.

Screen Shot 2015-04-02 at 22.24.30 .png

I'm looking into a more cartoony style but will need to generate the models completely in CE.  Polycount is less of an issue but manual labor will kill us 🙂

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Rule below, and also attached.

Capture.JPG

version "2014.1"

attr heightToRoof = 3.2

attr roofAngle = 40

attr overhangX = 0.5

attr overhangY = 0.5

attr roofExtrusion = 0.15

@Range (0,10)

attr wallThatYourFrontDoorGoesOn = 0

@Color

attr roofColor = "#804000"

@StartRule

BuildingFootprint -->

  alignScopeToAxes(y)

  s('1,0,'1)

  extrude(heightToRoof)

  comp(f) { top: Roof | side: Wall }

Roof -->

  roofGable(roofAngle, overhangX, overhangY)

  comp(f) {top: ExtrudeRoof | aslant: ExtrudeRoof | side: X.}

ExtrudeRoof -->

  extrude(world.y, roofExtrusion)

  color(roofColor)

Wall -->

  case comp.index == rint(wallThatYourFrontDoorGoesOn) % comp.total:

  WallWithDoorAndWindow

  else:

  X.

WallWithDoorAndWindow -->

  split(x) {~0.3: X. |

  1: DoorWall |

  0.5: X. |

  1.2: WindowWall |

  ~0.3: X.

  }

DoorWall -->

  split(y) {2.2: Inset | ~1: X.}

WindowWall -->

  split(y) {0.8: X. | 1.4: Inset | ~1: X.}

Inset -->

  extrude(-0.08)

  comp(f){side: reverseNormals X. | top: reverseNormals X.}

View solution in original post

0 Kudos
6 Replies
by Anonymous User
Not applicable

That is all very easy, except for the rounded corners. You will have to use a 3D model asset to insert the rounded corner.

Chris

0 Kudos
ErwinVervacke
New Contributor III

Hi Chris,

I believe the rounding of the corners could be handled during rendering ... need to check with the tech guy.

However, being a non-programmer/non-scripter and on a tight schedule at the moment, I would really appreciate a bit more elaboration on the 'very easy' part 🙂  Could you direct me so I can try to figure it out or (even better for me) provide a basic script I can tweak?

I learn best using the existing scripts and fiddle with them, did the same for 'complete streets' and a train track.  I wouldn't still be able to build the script myself but I do understand the steps.

The building footprints are in reality almost always slanted, not sure if that complicates things.

Many thanks and happy easter

0 Kudos
MatthiasBuehler
Occasional Contributor III

Hey guys,

I'd try to avoid making corners round with assets, since you will run into problems when dealing with non-rectangular footprints.

I'd use a recursive rule that creates the bevels, similar to the 'dome roof' of the 'Desert City Example'.

Let me know if you need more inputs.

Matt

Interested in CityEngine Training or Services? Contact me!

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

-------------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

0 Kudos
by Anonymous User
Not applicable

Rule below, and also attached.

Capture.JPG

version "2014.1"

attr heightToRoof = 3.2

attr roofAngle = 40

attr overhangX = 0.5

attr overhangY = 0.5

attr roofExtrusion = 0.15

@Range (0,10)

attr wallThatYourFrontDoorGoesOn = 0

@Color

attr roofColor = "#804000"

@StartRule

BuildingFootprint -->

  alignScopeToAxes(y)

  s('1,0,'1)

  extrude(heightToRoof)

  comp(f) { top: Roof | side: Wall }

Roof -->

  roofGable(roofAngle, overhangX, overhangY)

  comp(f) {top: ExtrudeRoof | aslant: ExtrudeRoof | side: X.}

ExtrudeRoof -->

  extrude(world.y, roofExtrusion)

  color(roofColor)

Wall -->

  case comp.index == rint(wallThatYourFrontDoorGoesOn) % comp.total:

  WallWithDoorAndWindow

  else:

  X.

WallWithDoorAndWindow -->

  split(x) {~0.3: X. |

  1: DoorWall |

  0.5: X. |

  1.2: WindowWall |

  ~0.3: X.

  }

DoorWall -->

  split(y) {2.2: Inset | ~1: X.}

WindowWall -->

  split(y) {0.8: X. | 1.4: Inset | ~1: X.}

Inset -->

  extrude(-0.08)

  comp(f){side: reverseNormals X. | top: reverseNormals X.}

0 Kudos
ErwinVervacke
New Contributor III

Thanks Chris!  Have had a lot of other issues to deal with but this rule works like a charm 🙂

0 Kudos
MatthiasBuehler
Occasional Contributor III

Hey Erwin,

I just checked creating the beveled corners. That seems to be trickier than thought, especially with concave footprints since you can not synchronize the bevel with neighboring facade shapes. I think this is not really possible in CGA, but would have to dig a lot deeper..

Matt

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

------------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

0 Kudos