# 界面熟悉
CityEngine的GetMapData有三类数据:
- Basemap:地图遥感数据
- Esri World Elevation:DEM数据
- OpenStreetMap:一个关于街道的网站
# CGA规则文件
参考文档如下:
# 基本规则
CGA规则文件都是以规则构成的,定义一条规则形式如下:
规则名-->
规则内容
1
2
2
其中以@StartRule修饰的规则是最开始执行的规则。样例如下:
Start1-->
extrude(30)
build
@StartRule
Start2-->
extrude(60)
build-->
color(0,1,0)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
要查看各个规则之间的关系可以在Model Hierarchy中点击Inspect model。要补全命令可以使用alt+/
来看下具体操作每个面,并且有贴图的操作:
version "2020.0"
# 开始文件
attr height = rand(9,24)
@StartRule
Start1-->
extrude(height)
build
Start2-->
extrude(60)
build-->
comp(f){front:frontArea |
back:backArea |
left:leftArea |
top:topArea |
right:rightArea |
bottom:bottomArea
}
frontArea-->
#红色
color(1,0,0)
backArea-->
#绿色
color(0,1,0)
leftArea-->
#蓝色
color(0,0,1)
topArea-->
roofGable(30)
roofTexture
roofTexture-->
comp(f){
bottom:bottomSide|
vertical:verticalSide|
top:topSide
}
topSide-->
//bottomSide-->
setupProjection(0,scope.xy,scope.sx,scope.sy)
texture("roof/florence_roof_tex_05.jpg")
projectUV(0)
verticalSide-->
setupProjection(0,scope.xy,scope.sx,scope.sy)
texture("roof/florence_roof_tex_05.jpg")
projectUV(0)
rightArea-->
setupProjection(0,scope.xy,scope.sx,scope.sy)
texture("florence_facade_12.png")
projectUV(0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 函数库
CityEngine的函数库分为:
- Operations Geometry creation Geometry subdivision Geometry manipulation Texturing Transformations Scope Flow control Context Attributes
- Shape attributes
- Built-in functions
- Other keywords
- CGA utility functions library
- Miscellaneous information
# 注释
行注释//,#
段注释 /* */
# UE的插件
参考资料:
除了CityEngine以外,UE有几个插件可以直接生成地形相关模型:
- Vitruvio CityEngine Plugin (opens new window)
- ArcGIS Maps SDK for Unreal Engine (opens new window)
- SuperMap Scene SDKs (opens new window)
- Cesium for Unreal (opens new window)
# 按高度生成
参考资料:
下面是操作步骤:
- 在相应规则下面选择Connect Attribute
- 选择相应的字段。
- 如果选择了图层,那么久可以看到如下代码:
attr a = getObjectAttr("b")