CityEngine demo version is expired so I have turned to Google SketchUp for park generation. I would like to apply the same technique of first generating OBJ input shape and then filling it with objects.
SketchUp is not particularly known for procedural content generation, however Ruby scripting and, even native plugin development can be employed, which could be sufficient for tree/flower/… placement.
SketchUp also has “Components” which could be instanced multiple times; they also appear to have special transformation anchors. I am not sure of the scope of component functionality yet, perhaps instances with random parameters is possible.
First bump in the ride that I have come across is that OBJ is not supported natively in SU. Luckily a free plugin (by TIG) did the job.
Scatter function is also not present in SketchUp. I had to go through a number plugins until I stopped at MatrixProximity (also by TIG). It allows to distribute copies of a selected component instance into a matrix. Random translation on the ground plane, rotation around the Up axis, and optionally scaling is added. On top of that I have introduced the following:
- Multiple components allowed (just sample the array)
- Place components inside the Group/Face
- Fit the component instances into the bounding box
- Add border equal to that of random a radius (max value) – to limit the placement inside the; additional border, to stay further from the edge, is possible
- Cast ray to the face, if the face is not met, discard the instance
- If group is selected, do the same operation for every face in the group
- Minor re-factoring included separation of functionality; a few setters were added, for example group_transform, border_offset...
The final script fill_park1.rb expects the group names provided with imported obj file.
Picture below demonstrates the park with Trees, Flower pots and Pedestrians (different pedestrians sampled).