1.1 建模与模型(中英对照)

来自Infinitipedia
跳到导航 跳到搜索
下一页

Infinity Artwork Design Document, 30 September 2007

Infinity美工设计文案,2007年9月30日

1. General guidelines

总纲

Note: in the following document, “S/S” will refer to a Space Ship or to a Space Station.

注:在以下的文档中,“S/S”代表飞船或空间站

1.1.Geometry

几何

a) File formats

a) 文件保存格式

At the moment, ASEToBin ( the tool used to import models into the game ) only supports .ASE ( Ascii Scene Export ) files. .ASE files can be exported from a various set of CAD softwares, but the file format changes subtely. Only 3ds Max seems to be able to export .ASE files in the correct format. In addition, most of the time some tweaks have to be made to the model: scale it to a coherent size, rotate it so that it has a matching forward direction, etc.. This is also done in 3ds Max. For those reasons, all files have to be received in a format that can be opened or imported by 3ds Max. You can use other CAD softwares ( this includes but is not limited to Maya, Lightwave, Sketchup, Blender, Milkshape, etc.. ) provided that you can export and send your model in one of these formats:

目前转码工具ASEToBin(用来将模型导入游戏的工具)只支持ASE文件。很多CAD软件可以生成ASE文件,但文件格式有微小变化。只有3DS MAX可以准确导出ASE文件。

另外,一般需要对完成的模型作一些调整,比如将其缩放到合适的尺寸、将其旋转一定角度对齐方向,等等。这些操作也要在3DS MAX中完成。因此,提交的文件必须采用3DS MAX 可以打开的格式。 也可以使用Maya, Lightwave, Sketchup, Blender, Milkshape等CAD工具,但完成的作品必须用以下文件格式提交:

–.3DS as a standard. Note: bitmaps file names are truncated to 8.3 characters, so have to be manually fixed after being reimported in 3ds Max.

  • 以.3DS格式为标准格式。注意,位图文件名会转换成8位主名加3位扩展名形式,所以重新导入到3DsMax中时要手动修正。

–If you are using Blender, send the .blend file directly.

  • 如果使用Blender,请直接提交.blend文件。

–If the .3DS file is incomplete or corrupted, use .OBJ. It will most likely cause problems with animations or smoothing groups, but the basic geometry / UV-mapping should be fine.

  • 如果生成的.3DS文件不完整或损坏,请使用.OBJ格式导出。这样可能对动画或平滑效果造成一定影响,但基本的模型结构和UV贴图会完好保留。

–.WRL ( vrml ) as last resort.

  • 实在不行就用.WRL(vrml)导出。

I1.jpg

Workflow.png

Illustration 1: Workflow

图1:操作流程

b) Objects / meshes within a single CAD file

b) 单个CAD文件中的对象/网格(Objects / meshes)

–The model can be made of different logical objects ( meshes ).

  • 模型可由不同的逻辑对象(网格( meshes ))构成

–Separate into different objects any section of the model that can be animated

  • 将模型中所有运动的部分拆分成独立的对象

–Separate into different objects any section of the model that can break. For example, wings on ships.

  • 将模型中所有可脱落部件设定为独立的对象,如舰船的翼。

–Separate into different objects any section of the model that is modular ( see the chapter about Modules ). All modules of the same ship should be part of the CAD file: do not use one CAD file per object ! The only exception to that is, if you need to share some modules between different types of ships. In this case, store the shared modules in their own file.

  • 将模型中所有模块化的部分设定为独立对象(见“模块”章节)。一艘舰艇上的所有模块都应包括在同一个CAD文件中,只有当有些模块为不同舰船模型共享时,才需要将相应对象存为单个文件。

– Separate into different objects any section of the model that is too large ( in actual world dimensions ). This will help the 3D engine's performance by doing per-object frustum culling. In general, target one object per 250m ( If your ship is 2 Km long, split it in 8 objects ). Split the model in objects where it makes the more sense compared to the structure / architecture of the model. Target a maximum of 10,000 triangles per object at most.

  • 将模型中尺寸过大的部分(按真实世界的标准)设定为独立对象。此举有助于3D引擎对对象的层次视锥剔除运算。一般地,每250米分一个对象(即,如果一舰船模型长2千米,将其分为8个对象)。不要单纯根据模型结构分割对象。每个对象三角数不要超过1万。

–Merge into a single object all objects that are too small or not very complex, and that form a “rigid body” ( a body where all triangles share the same movement ).

  • 将尺寸很小或结构简单的多个对象整合成一个对象,构成一个“刚性体”(rigid body)(构成刚性体的所有三角形在动画中均同步运动)。

—In general, try to use no more than 1-5 objects for a small model ( like a fighter, < 50m ), 1-10 objects for a medium model ( hunter, 50m-750m ), and 3-25 objects for larger models ( carriers, battleships, > 750m ).

  • 一般,如战机等尺寸小于50米的小型模型,使用的对象数不要超过5个。如航母、战舰等大型单位的对象数控制在3-25个。

c) Mesh quality

c) 网格质量(Mesh quality)

There are few mistakes often made regarding mesh quality:

网格数量的常见错误:

– Quality of tesselation ( density of polygons ): make sure you do not waste too many polygons on curved surfaces, especially if the object has small dimensions. Inversely, make sure the tesselation is sufficient on very curved, large surfaces. For example, do not use 40 segments for a cylinder that is in a hidden spot, or very small.

  • 多边形密度(Quality of tesselation ( density of polygons ):):不要在曲面上浪费过多的多边形数,尤其不必把小物体做得过细。相反,在较大的弯曲面上要应用较高的多边形密度。例如,一个在不显眼位置的或者很小的圆柱型就不必分割成40段。

– Self-penetrating objects: objects or groups of triangles that penetrate / intersect each other at a glancing angle. The triangles near the intersection are almost parallel, which lead to Z-fighting artifacts ( see Z-Fighting below ). If the angle at which those triangles intersect is steep ( like almost at 90° ), then it is allowed.

  • 自交叉对象(Self-penetrating objects):指交叉角度很小的三角面组或对象在交汇处的失真。由于靠近交叉处的三角接近平行,容易导致Z缓冲冲突(Z-fighting artifacts)(见以下相关部分)。如果三角面交角较大(如接近九十度)则不会出现这种现象。

– Backface culling: Backface culling is the process of removing triangles that are “facing away” the camera in a real-time renderer. Imagine a cube: if the cube is seen from outside, it appears normally. However if the camera enters inside the cube, the faces of the cube will not be visible, because they are facing away from the camera.

  • 隐面剔除(Backface culling):隐面剔除是在实时表现三维图像时,把背向取景器的三角面隐去的一个过程。例如,从外部观察一个立方体,与一般没有什么区别。但当取景器在立方体内部,由于这时立方体的各个面是背向取景器的,所以不可见。

All models must work fine with backface culling.

所有模型必须应用隐面剔除。

This implies that the mesh must form a coherent volume, and have no holes. It also implies that the triangles of the mesh have a coherent winding: clockwise or anti-clockwise. If some of your triangles are clockwise and others are anti-clockwise, backface culling will be messed up, and holes will randomly appear in the mesh when viewer in real-time. Fixing backface culling generally needs you to select all faces that are incorrectly culled, and to flip their normal.

也就是说,模型网格必须构成一个连贯的立体,不可有漏洞。而且网格上三角面的缠绕方向也应当是一致的,必须全部依顺时针或逆时针方向。如果有些用顺时针,有些逆时针,隐面剔除就会发生错误,实时检测模型时就会看见网格上有随机出现的漏洞。要修复此问题,通常需要反转所有没有正确应用剔除的面的法线方向。

– Welding vertices: make sure vertices are not duplicated uselessly. Do not weld vertices after you have updated the normals or smoothing groups of your objects, or the smoothing groups will be messed up.

  • 顶点合并(Welding vertices):确保去除无谓重复的顶点。更新完对象的法线方向或平滑组后,不要再合并顶点,这样会导致平滑组错误。

– Normals / smoothing groups: most of the time, applying an auto-smoothing of 30° is good enough. Sometimes, you will have to manually review some areas, like curved surfaces, and fix the smoothing manually. Normals/smoothing groups are used for lighting, incorrect normals will result in incorrect lighting, or “dark” triangles on the surface..

  • 法线/平滑组(Normals / smoothing groups):多数情况下应用30°自动平滑就足够了。但有时必须手动修改某些区域,比如曲面的平滑。法线/平滑组在照明中要用到,错误的法线方向会导致照明错误,或在表面上出现“暗的”三角面。

– Z-fighting: Z-fighting happens when some triangles are near co-planar ( ie. They are paralell, and very close to each other ). The depth cannot be resolved anymore in the Z-Buffer in realtime and causes some pixels to flicker. Coplanar triangles causing Z-fighting must be avoided at all costs. One of the causes for Z-fighting is duplicating a triangle or part of an object, and forgetting to move it.

  • Z缓冲冲突(Z-fighting):当几个三角面接近共面时(也就是近似平行,且彼此间距离很小),就会发生Z缓冲冲突。这些面之间的景深无法用Z缓冲实时表现出来,会造成图像闪烁。必须尽一切可能避免共面三角导致的缓冲冲突。如果建模过程中复制了一个三角面或者一个对象的一部分,事后又忘记把复制的部分移除,就会造成Z缓冲冲突。

– T-junctions: this a minor ( almost unnoticeable ) mesh error, but it's still nice to avoid them. T-junctions happen when a vertex of a triangle falls in the middle of the edge of another triangle. This causes a 1-pixel gap when looking at the geometry in real-time. It can also cause problems during the level-of-detail generation phase. See the following image: Infinity Artwork Design Document, 30 September 2007

  • 丁字节点(T-junctions):这是有关网格的一个小问题,几乎是看不出来的,但最好还是避免。当三角面的一个顶点落在另一个三角面一边的中间时,就会产生丁字节点。实时表现时,节点处会有一个1像素大小的缺口。这在细节水平生成阶段可能会造成麻烦。见下图:

I2.png

Illustration 2: T-Junctions are evil

图2:丁字节点是魔鬼

d) Coplanar polygons

d) 共面多边形

Coplanar polygons / surfaces are a very bad thing and considered mesh errors in some cases ( Note: coplanar polygons are polygons very close to each other, and that are near parallel ). The problem with coplanar polygons is Z-Buffering. The Z-Buffer of a video card is used to paint the pixels the closest to the camera and to remove hidden pixels. The Z-Buffer basically stores the distance to the camera for each pixel, and when a new pixel is drawn, it checks if its distance is closer or not. If the incoming pixel is not closer, it is discarded. Problems start to appear due to the fact that the Z-Buffer is encoded on 24 bits in the video memory. The distances used in the Z-Buffer are not linear due to the way floating point numbers are encoded on computers. You get more precision close to the near-clipping plane than the far clipping plane.

共面多边形/共面表面是非常麻烦的,有时候也作为网格上的错误处理(共面多边形即非常接近且近似平行的多个多边形)。问题的原因是Z缓冲。显卡的Z缓冲是只显示重叠的多个像素点中离取景器最近的一个,去除后面看不见的像素。Z缓冲会记录每个点到取景器的距离。当一个新的点出现时,它会检测这个点是比较近还是比较远。如果新出现的像素点比较靠后,就去除掉。共面多边形之所以会造成显示问题是由于显存中的Z缓冲是24位编码。由于计算机中浮点数编码的特殊性,Z缓冲中所用的距离是非线性的。离取景器较近的点的距离数值就比景深较大的点的数值要来的精确。

How is that relevant to the coplanar polygons problem ? Easy: when rendered, the two pixels on each respective coplanar surface will end up with the same Z value, if the distance between those surfaces ( what is usally called the thickness) is small. If those two pixels end up with the same Z value, they will randomly flicker when seen on screen. The problem is getting worse depending on the size of the surfaces, the distance of the camera and the thickness. The further away the camera is, the harder it becomes for the video card to resolve Z values for near coplanar surfaces ( due to the non-linear nature of the Z-Buffer as explained above ). The smaller the thickness, and the worse it becomes. The worst case is of course a small thickness seen at a far distance.

那么这与共面多边形所导致的问题有什么联系呢?这是因为在实时表现时,如果共面表面上间的距离很近(通常称为厚度),那么这些面上的两个重叠像素点的Z值就会是一样的。Z值相同的重叠点在屏幕上会随机闪烁。这个问题的严重程度取决于表面的面积大小,景深,以及厚度。由于上面说过的Z缓冲中距离数据的非线性,景深越大,显卡就越难分辨两个相邻共面表面的Z值。同时,厚度越小,闪烁越严重。最坏的情况就是从远距离观察厚度很小的对象。

I3t.png

Illustration 3: Coplanar polygons

图3:共面多边形

Since small ships become near-dots at a big distance, they're usually the ones the less affected by those kind of problems. However, large ships ( kilometer-sized or more ) can have troubles if geometric detail is done by using coplanar surfaces with a small thickness.

小型舰船从远距离看不过是些小点,所以它们受上述问题的影响不大。但对以公里计尺寸的大型舰船来说,用小厚度的共面表面来构造模型细节就会产生问题。

Note 1: even non-coplanar / non-perfectly parallel surfaces can cause similar problems, for example when they intersect to each other at a very low angle.

注意1:即使不是完全共面/平行的表面,要是小角度相交,也可能产生类似问题。

Note 2: there is a specific case where coplanar / parallel surfaces ( that are very close to each other ) are acceptable, and that's when they have opposite orientations. Backface culling will ensure that only one of the two surfaces will be displayed in the Z-Buffer anyway, meaning that there won't be any Z-fighting problem. It's better to not rely on this behavior until you perfectly understand what's going on.

注意2:只有在共面表面或近距离平行表面的法线方向不同时,才可以在模型中使用。因为隐面剔除使得两个面只有一个会显示出来,这样Z缓冲就不会出现冲突了。如果您还没有透彻地理解这个过程的内部机理,就不要使用这种方法。

In order to fix those problems, what you should do is to merge the surfaces together ( generating vertices at the intersection between the hull and the geometric details ), then remove the polygons under the hull that won't be visible from the outside anyway. This operation can significantly increase the polycount of the ship, so be careful ! But it is the preferred way to completely avoid Z Fighting issues ( and to help the level-of-detail algorithm ).

修正这个问题的方法是将这些表面整合为一个(在船体和模型细部之间放置一些顶点),然后去除船体下那些从模型外部看不见的部分。然而这一操作将大大增加模型的多边形数,务必谨慎。但是这是避免Z缓冲冲突的较好方法,也有助于LOD(自动减面)算法的实现。

It is acceptable to use intersecting objects / details when the thickness is huge. This will help to keep the polycount down. In summary, you should ensure that objects or details don't intersect unless the coplanar polygons have a huge thickness. See Illustration above as an example. Note that in all 3 cases a viewpoint far away from the ship will see the same silhouette, but only in the good and acceptable cases, Z-fighting will be avoided.

厚度很大时,允许使用交叉的对象或模型细节,以降低多边形数。总的来说,就是除非共面多边形之间的厚度很大,不要使用交叉的对象或模型细节。参考上面的例子,注意在所有3种情况下,从远离模型的地方观察,都会看到同样的闪烁轮廓,只有在正确的做法下,才可以避免Z缓冲冲突。

e) Finalization

e) 定稿

– Pivots: make sure all objects in your model have a pivot placed on the center of the object ( unless you have valid reasons to place the pivot somewhere else ). I noticed a lot of models with incorrect pivot points.

  • 中轴(Pivots):除非有充分理由将中轴设置在其他位置,必须在模型的中央设置中轴。我看到很多模型的中轴设置错误。

– Units: make sure your model uses the metric unit.

  • 单位(Units):请使用公制长度单位。

– Scale: make sure your model is matching the specification's dimensions. 3Ds max has a tool to measure the distance between two points.

  • 尺寸(Scale):请确保模型大小符合相应模型分类的尺寸要求。在3DS MAX中有用来测量两点间距离的工具。

– Origin: make sure the center of the whole model ( all objects taken as a group ) falls on the scene origin, at ( 0, 0, 0 ).

  • 原点(Origin):确保整个模型(即,包括所有对象)的中心落在场景的原点(0,0,0)上。

– Orientation: make sure the orientation of the whole model ( all objects taken as a group ) is oriented towards the +Y axis ( the “front” axis ). The +Z axis should be the “up” axis.

  • 朝向(Orientation):确保整个模型朝向Y轴正方向(即前向轴)。Z轴正方向作为上方。

– Polycount: make sure your model is near the target polycount ( see the reference table about polycounts for ships and various entities ). The polycount should be measured in triangles, and not quadrilaterals.

  • 多边形数(Polycount):确保模型的多边形数接近要求的数值(参见各种模型的多边形数参照表)。多边形数按三角面数量计,不要按四边形数计。
  • 各位设计者需要注意的几个关键问题

http://www.infinity-game.com/bbs/viewthread.php?tid=963

下一页