You are here:-CityEngine函数库

街道规则及函数说明

转自 http://blog.sina.com.cn/s/blog_841eeb5201010p3e.html 街道规则 CityEngine在贴图的实现过程有两种方式:第一种是通过i(geometryPath)规则引入外部带贴图的模型;第二种方式是通过texture(string  texturePath)规则在CityEngine内部通过规则控制来完成贴图的实现。下面通过具体的例子谈一下这两种方式在实际中的应用。 引入外部带贴图的模型 适用方向:模型被重复利用、结构较为复杂。 下面以盖板为例来说一下引入外部带贴图模型的方法。 一、     模型导出时的注意事项 在用3DMax软件把其它格式的模型导出为CityEngine支持的部件格式(如obj)时,要选择带有贴图纹理和贴图坐标。   默认情况下,OBJ导出选项窗口的面选项为四边形,为了减少面数据根据需要可以选择多边形;材质导出的窗口中转换位图是被选中的,此种情况下贴图的的尺寸会发生变化。下图为max模型效果与导出obj之后在max里的显示效果:   二、     引用规则的代码与效果 Street--> split(u,unitSpace,0){~3.6:Str_Tex | 0.2:color("#ff0000") X}* Str_Tex--> i("obj/gaiban.obj")   从上面两个图可以看出不用任何贴图的代码就可以完成模型的贴图。 通过内部规则控制实现纹理贴图 通过内部规则控制实现纹理贴图,主要是指采用texture的方式进行贴图。在使用texture进行贴图的过程中其最关键的在于约束texture引入的图片所代表的实际大小和其摆放的位置等信息,因而就产生了控制图片代表实际尺寸、图片重复的次数两种方式的贴图。下面就针对这两种方式进行简单的介绍。 控制图片代表的实际尺寸 适用范围:主要指建筑物、护栏等的贴图。 引用的规则代码: Lot--> extrude(10) comp(f){front:ftFacade | all:X} ftFacade--> setupProjection(0,scope.xy,scope.sx/rint(scope.sx/2.5),scope.sy/rint(scope.sy/1.5)) texture("WINDOW_02.jpg") projectUV(0) 与贴图相关的规则介绍: setupProjection(uvSet,axeSelector,texWidth,texHeight) 该规则主要是对texture所引入的图片进行了约束,其中uvSet的取值范围[0,5],分别代表不同的Texture Layer,一般选0值;axesSelector确定了贴图时图片的U向和V向,texWidth和texHeight分别代表图片的尺寸所对应的实际的宽度和高度。 texture(string texturePath) 该规则引入相应的贴图。 projectUV(uvSet) 该规则通过应用相应的投影矩阵创建最终的纹理坐标。与3D Max的塌陷功能有点类似。 引入该规则之后建筑贴图的效果。 控制图片的重复次数 适用范围:道路或与道路相关的具有走向的平面贴图。 引用的规则代码: lenAlongU=geometry.du(0,unitSpace) Sidewalk--> NIL Street--> normalizeUV(0, uv, collectiveAllFaces) scaleUV(0,rint(lenAlongU/20),1) texture("street_1lanes_stripes.png") 与贴图相关规则的介绍: normalizeUV(uvSet,uvNormalizeMode,uvNormalizeType) 该规则约束了贴图是沿走向方向上进行贴图的。uvNormalizeMode有三个值的选项:u、v和uv;之前做了一个简单的测试发现它们的区别不是很大,在道路上贴图时一般选择uv项;uvNormalizeType有两个值的选项:separatePerFace和collectiveAllFaces,之前采用第一个值时发现贴图时并不按走向进行贴的,一般选择第二个值。 scaleUV(float uvSet, float uFactor, float vFactor) 该规则约束了当前贴图时的重复次数,其中uFactor代表长度方向上的重复次数,vFactor代表宽度方向上重复次数。 附注:本文档提供的规则代码可以在实际中实用,通过调整某些参数的值我们将会更清晰的理解这些规则、更好的实用这些规则。由于水平有限,其中的内容有解释不清的地方敬请雅正。

作者:| 2017-12-26T10:37:42+00:00 十二月 26th, 2017|分类:CGA, CityEngine函数库|街道规则及函数说明已关闭评论

CityEngine函数库更新历史

City Engine version (= CGA version)Changes2016.0 CGAC 1.6New operations: softenNormals operation. innerRectangle operation with alignment and remainder options. It replaces theinnerRect operation that is deprecated. primitiveQuad, primitiveDisk, primitiveCube, primitiveSphere, primitiveCylinder andprimitiveCone operations. The primitiveCube operation replaces "builtin:cube" and"builtin:cube:notex" that are deprecated. splitArea operation. Changes to existing features: setNormals operation: New mode auto that uses softenNormals

作者:| 2016-07-23T00:05:17+00:00 七月 23rd, 2016|分类:CityEngine函数库|CityEngine函数库更新历史已关闭评论

splitArea

地块分割函数 类型一:splitArea(splitAxis) { area1 : operations1 | ... | arean-1 : operationsn-1 } 类型二:splitArea(splitAxis) { area1 : operations1 | ... | arean-1 : operationsn-1 }* 类型三:splitArea(splitAxis, adjustSelector) { area1 : operations1 | ... | arean-1 : operationsn-1 } 类型四:splitArea(splitAxis, adjustSelector) { area1 : operations1 | ... | arean-1 : operationsn-1 }* 参数 splitAxis (selstring) (x

作者:| 2016-07-13T21:40:59+00:00 七月 13th, 2016|分类:CityEngine函数库|splitArea已关闭评论

primitiveCone

原生椎体 类型一:primitiveCone() 类型二:primitiveCone(sides) 类型三:primitiveCone(sides,radius,height) The primitiveCone operation inserts a cone geometry into the scope of the current shape. If no radius and height are given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. If dimensions are specified the cone is positioned in the

作者:| 2016-07-12T19:36:59+00:00 七月 12th, 2016|分类:CityEngine函数库|primitiveCone已关闭评论

primitiveCylinder

原生柱体 类型一:primitiveCylinder() 类型二:primitiveCylinder(sides) 类型三:primitiveCylinder(sides,radius,height) The primitiveCylinder operation inserts a cylinder geometry into the scope of the current shape. If no radius and height are given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. If dimensions are specified the cylinder is positioned in the

作者:| 2016-07-12T19:35:55+00:00 七月 12th, 2016|分类:CityEngine函数库|primitiveCylinder已关闭评论

primitiveSphere

原生球 类型一:primitiveSphere() 类型二:primitiveSphere(sides,divisions) 类型三:primitiveSphere(sides,divisions,radius) The primitiveSphere operation inserts a sphere geometry into the scope of the current shape. If no radius is given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. If radius is specified the sphere is positioned in the xz-center of

作者:| 2016-07-12T17:09:14+00:00 七月 12th, 2016|分类:CityEngine函数库|primitiveSphere已关闭评论

primitiveDisk

原生圆形 类型一:primitiveDisk() 类型二:primitiveDisk(nVertices) 类型三:primitiveDisk(nVertices,radius) The primitiveDisk operation inserts a disk geometry into the scope of the current shape. If no radius is given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. If radius is specified the disk is positioned in the xz-center of

作者:| 2016-07-12T16:29:50+00:00 七月 12th, 2016|分类:CityEngine函数库|primitiveDisk已关闭评论

primitiveCube

原生方体 类型一:primitiveCube() 类型二:primitiveCube(width,height,depth) The primitiveCube operation inserts a cube geometry into the scope of the current shape. If no width, height and depth are given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. If dimensions are specified the cube is positioned in the

作者:| 2016-07-12T15:43:00+00:00 七月 12th, 2016|分类:CityEngine函数库|primitiveCube已关闭评论

primitiveQuad

原生四边形 类型一:primitiveQuad() 类型二:primitiveQuad(width, length) The primitiveQuad operation inserts a quad geometry into the scope of the current shape. If no width and length is given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. If dimensions are specified the quad is positioned in the

作者:| 2016-07-12T14:45:08+00:00 七月 12th, 2016|分类:CityEngine函数库|primitiveQuad已关闭评论