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?
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?
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.
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.