To access the tutorials in CityEngine, click Help > Download Tutorials and Examples.... After choosing a tutorial or example, the project is automatically downloaded and added to your workspace.
Polygonal Modeling and Rules
First of all, why would we want to do this? Suppose you want to give all windows of this house a nice 3d frame.
Currently it’s just a flat texture. Of course you could drag the frame out for every window, but this is quite tedious. Also, the window texture does not adapt nicely when scaled. Here you get some cuts in the windows:
To conveniently place 3d windows, we use a rule on the building. Here is how:
- First, create a 3d window. Use the rectangle tool and drag it up.
- Select the front face with the selection tool and assign the window texture with the texturing tool.
- Then draw a few rectangles over the window frame with the rectangle tool. Drag them to create a 3d structure. Feel free to experiment with different structures.
- Select the model, then choose File > Export models.
- Choose Wavefront OBJ and set the name to window.
- Click Finish.
- Select the house, right click Assign Rule File.
- Select rule.cga from the tutorial folder, and then press generate.
- Bring up the Inspector and select the house.
- Enter values in the window parameters and all the windows update automatically.
This finishes our window.
To use it in a rule, you have to export it first.
Make sure the folder is the tutorial/model folder.
Now we can apply the rule.
Note:
This rule replaces all polygons with window textures with the 3d window. You can look at it and use it for your projects.
All windows are now 3d shapes, and you can see the difference by toggling the show/hide models switch.
If you drag the window frame, it adapts much nicer.
You can also change global parameters.