Select to view content in your preferred language

Chimneys on roof

3395
6
10-10-2013 12:27 AM
JamieIngall
Emerging Contributor
Hi there,

I am new to CE and am trying to create a variation of building types for a city representation that is based on land cover. I have extruded buildings with various features but i am not aware of how to add roof features such as chimneys etc. I have read the desert city tutorial but the scripting is complex and the roof features are predominantly for flat roofs rather than Gable roofs. 

Does anyone have any advice they would be willing to share on where to begin?

Thanks in advance.
0 Kudos
6 Replies
MatthiasBuehler1
Deactivated User
Hi !

sharing knowledge - that's what this forum is about ! 😮


can you post a few reference images of what you need precisely ?

cheers !

m.
0 Kudos
JamieIngall
Emerging Contributor
Hi Matthias,

thanks for the reply!

I have attached an image that I found on the city engine forum together with an actual image of the kind of thing I want to represent...
Although I do not necessarily need to go in to such fine detail, I need a rule which will create chimneys for detached and terraced housing.  Ideally these  would be random in height/width and shape?

Thanks again,

Jay

[ATTACH=CONFIG]28227[/ATTACH]  [ATTACH=CONFIG]28226[/ATTACH]
0 Kudos
MatthiasBuehler1
Deactivated User
Hi !

Here's 2 strategies which proved being useful :

I recoded them for you with notes. Check if you understand every single thing in this code.

[ATTACH=CONFIG]28269[/ATTACH]


Let me know where's questions.

Matt
0 Kudos
JamieIngall
Emerging Contributor
Hi,

Fantastic! great examples thank you for that.

There is a couple of things I am a little confused about;
Within the v1 model :

"ChimneyShape -->
case p(perShapeChimneyProbability) :
  scatter(surface, 1, uniform){PutChimney}
else :
  NIL

PutChimney -->
alignScopeToAxes(y)
s(chimneyDimXZ, chimneyDimY, chimneyDimXZ)
center(xz)
i("builtin:cube")
Chimney."


and within the v2 model :

RoofBase -->
convexify() # may be a weird shape, so convexify it
comp(f) { all : alignScopeToGeometry(yUp, 0, longest) PotentialRoofTopBase } # align scope.sx to the longest edge

PotentialRoofTopBase -->
case scope.sx < chimneyDist / 2 : # delete short polygons.
  NIL
else :
  RoofDistribution


I am not entirely sure what these part of the rules are doing to the model?

Also I am a little confused as to what the floating red shapes above the roof is. Am I right in assuming that these are a by-product of the model? and is there any way that I can remove them?

Thanks again,

Jamie
0 Kudos
MatthiasBuehler1
Deactivated User
1]
The red parts are just copies of the base geometry moved up, so you see the 'main idea' of the two approaches. Of course they would not be created otherwise. Those just show the basic idea. inspect them carefully.

Note the '.' dot. Use it to stop the rule generation at any point to observe how the code goes.

E.g.
Lot -->
    A

A. -->
    B


The dot basically renames the target rule, so A cannot be found. But the dot also suppresses the yellow 'undefined rule' warning.

2]
the first version uses flat polygons as a base for a scatter() operation. Means you scatter copies of chimney boxes on the roof surface. Anywhere

So : split the roof faces back to a point where we are near the top, then we can add a roof anywhere with a 25% probablity. Note how that code generates something realistic in every possible geometric start situation. 'That's procedural modeling' 🙂 Make the code work in every situation.

3]
the second approach is a bit trickier.

Cut the roof volume back to the last 10%. The result is a 3d volume again. When we use only the bottom of this 3d volume, in complex roof cases, that polygon can be a complex concave polygon, e.g. a big 'z' form or such. convexify cuts this form into convex subshapes. aligning then to the longest edge of each subshape and checking if the longest edge has a certain length then makes finally sure that you place chimneys only in places that are on 'long enough' parts of the ridge.
Note how the resulting geometries are again handled so that they work in every possible case.


Better ?
More questions ?

I'd really recommend you write the same code down yourself again manually. This will make things clearer.

ok ?
0 Kudos
JamieIngall
Emerging Contributor
That makes much more sense. I will go through the code bit by bit to ensure I understand properly.

Thanks for all your help!
0 Kudos