個人檔案Quake3 启示录相片部落格清單更多 工具 說明

部落格


7月11日

Gamebryo/Artist's Guides/Gamebryo 3ds max Plug in/Geometry and Performance

Introduction to Geometry, Performance, and 3ds Max
A basic geometric question facing all real-time 3D artists is "How should I construct my scene so that I can maintain great real-time rendering speed?"
There are numerous factors that affect performance, including how many triangles to use, the number of textures applied to a single surface, and the target platform. The sections that follow discuss these issues in more detail.

对所有实时3D美工人员面对的基本的几何学问题是"为了维持良好实时渲染速度,我应该怎么构建我的场景?"
这里有很多因素可能影响性能,包括使用了多少三角形,应用到一个单独平面的纹理贴图的数量,以及目标平台。接下来的章节我们将详细讨论这些问题。

Terminology
术语

The Triangle/Mesh Ratio
Triangle / Mesh 比值

Transform-Rate, Fill-Rate
转换率,填充率

Clipping & Culling
剪切和剔除

Triangle/Mesh Ratios vs. Clipping and Culling
Triangle/Mesh 比值与剪切和剔除比较

Grouping
群组

Skinning & Morphing
蒙皮 & 变形

Cloning and Instancing
克隆和实例化

Multi/Sub-Object and Triangle/Mesh Ratios
Multi/Sub-Object 物体 和 Triangle/Mesh 比值

Multiple UVs, Smoothing Groups and Vertices
多重 UVs,光滑群组和定点

Precache Custom Attributes
预先缓存定制属性

Terminology
术语

The following section will introduce key terms and phrases that you should understand before discussing geometry.
接下来的章节将在讨论几何体之前介绍一下你应该理解的一些关键术语和惯用语

Stripification
条带化

This term describes an operation in which a list of independent triangles is transformed into a list of triangles that are linked together in a chain. Although this operation can increase performance, it is mutually exclusive with the Vertex Cache optimization which only operates on triange lists. Vertex cache optimization generally gives better performance results.

这个术语描述了一个操作,在这个操作中一系列独立的三角被转化成一个三角形条带。尽管这个操作可以提高性能,但它和三角形列表上的顶点缓存优化是互斥的,而顶点缓存优化通常能带来更高的性能。(而且条带化要条带足够长才能优化,而很多三角形不能形成很好的条带)

Mesh (or NiMesh)
网格

This term describes the Gamebryo representation of geometry. A mesh contains all of the per-vertex information about a piece of geometry, including vertex positions, normals, vertex colors, and UV sets. A mesh is usually composed of independent triangle primitives, but if the mesh has been stripified it will be composed of a set of triangle strips.
这个术语描述了Gamebryo如何表示几何体。一个网格包括一块几何体的所有顶点数据信息,包括顶点位置,发现,颜色,和UV集合。一个网格通常由独立的三角形图元组成,但如果网格被条带化,那么它将由一套三角形条带组成。

The Triangle/Mesh Ratio

The triangle to mesh ratio is the most important geometric metric for game performance. The issue with triangles and meshes is that when rendering an mesh, Gamebryo must do a fixed amount of work on the CPU (property-state setup, texture swapping, etc.) each time it passes down the set of triangles, no matter how big. You should, thus, try to pack as many triangles as possible into each mesh.
三角形对网格的比值对游戏的性能是一个非常重要几何度量。三角形和网格的问题是:当渲染一个网格时,无论每次处理的三角形集合多大,Gamebryo在CPU上必须做固定负荷的工作(属性设置,纹理交换等等) 。一次你应尽可能向每个网格打包更多的的三角形。

In general, a game should never have fewer than 20 triangles per mesh. You don't have to increase the number of triangles just to improve the triangle/mesh ratio, but if doing so will improve vertex lighting or some geometric detail, it won't hurt the performance. Another way to tackle improving the ratio is to collapse similar meshes with the same materials that are close together in a scene. This collapsed mesh will be converted to a single mesh instead of several separate meshes, thus improving the overall ratio.
总的来说,一个游戏每个网格不能少于20个三角形。你不需要为了提高三角形/网格比率而特意增加三角形个数,虽然这么做可以提高顶点光照和几何体细节,但不要让他损害性能。另一个途径是折叠在场景中相邻并使用的相同材质的网格。这样折叠的网格将转换成一个单独的网格而不是几个分散的网格,这样将改善原来所有单独网格的比值,让比率获得全面的提高。

The importance of a large triangle/mesh ratio (i.e. a lot of triangles per mesh) is increased on hardware transform and lighting cards (high-end graphics cards). Hardware transform and lighting cards perform vertex transformation, lighting, and rasterization on the graphics card. Earlier cards could only perform the rasterization while the CPU was forced to do the vertex transformation and lighting.
增大三角形/网格比率的价值(例如,一个网格拥有大量三角形)随着硬件变换和光照显卡(高端图形显卡??很多年前喽)出现而变得重要。硬件变换和光照(T&L)显卡在显卡端执行顶点变换,光照和光栅化。而早前的显卡只能执行光栅化而cpu被迫执行顶点变换和光照的计算。

Hardware transform and lighting cards both free the CPU of this task and perform it faster than the CPU ever could. This division of labor decreases the time required to render an individual polygon but leaves the fixed amount of work that Gamebryo must do for each mesh (discussed earlier) unchanged. In a low triangle/mesh situation the CPU will become the bottleneck (doing the rendering setup) and the full rendering capabilities of the graphics card will not be used. In contrast, a high triangle/mesh ratio will allow the graphics card to draw as many polygons as possible and leave the CPU free to perform other operations.
硬件T&L显卡减少了CPU的这项任务而且比CPU处理的更加迅速。这种分工减少了渲染一个单独多边形的时间,但是留给Gamebryo的每个网格的工作量没有改变。在三角形/网格第比值的较低情况下CPU将变成瓶颈(执行渲染设置操作),而显卡的全部渲染能力没有被用到。相反,三角形/网格高比值将允许显卡尽可能多的绘制三角形从而留给CPU空闲去执行其他工作
尽可能把相同材质多边形放入同一个网格,而不是无尽的增加网格的三角形面数

Performance Metrics
性能标准

Performance analysis done at nVidia and ATI revealed that on a 1 GHz CPU, you can render 25,000 objects per second before you spend all of your time on the CPU, a circumstance you wish to avoid at almost all costs.
根据nVida 和 ATI 透漏的性能分析数据,在1GHz CPU 上,当你花费CPU全部时间,你可以每秒钟渲染25000个对象,而这种全部花费的情况是你希望避免的

What do these statistics mean to an artist? For performance of 60 fps on a 1 GHz CPU, try to keep the number of visible objects in any given scene below 417 objects. In other words, make every object count!
这个统计对于美工意味着什么呢?为了在1Hz CPU 上保持60fps的性能,应该在场景中控制可见对象少于417个。注意每个物体都要计算

As the CPU speed of the target machine increases, the number of visible objects that may be rendered per frame will correspondingly increase.
The following sections will discuss how art content issues could increase or decrease the Triangle/Mesh ratio.
随着cpu的速度越来越快,每一帧渲染的物体数量也会相对增加。下一章将讨论美工内容如何提高或者减少三角形/网格比值

Transform-Rate, Fill-Rate
变换速率,填充速率

Transform-Rate

The transform-rate is the number of vertices a graphics card can process in a given time period. When the number of vertices to be transformed (moved, rotated, and lit) per time period exceeds the graphics card's capabilities, an application is said to be "transform limited."

The following table shows the maximum T&L rate for various PC graphics hardware:
变换率是指图形显卡在给定的时间周期内处理顶点的个数,如一个周期内变换(平移,旋转,照明)的顶点个数超过显卡的能力,可以说应用程序到达了"变换上限"。下列表格列出了不同的PC显卡最大的T&L的速率:

Manufacturer & Card

 

T&L - million vertex/sec

nVidia GeForce 3

40

nVidia GeForce 4 Ti

136

NVidia GeForce FX

200

nVidia GeForce 6800

600

ATI Radeon 8500

75

ATI Radeon 9700

300

ATI Radeon X800

780

These values are, of course, theoretical peaks and do not represent real-world game situations. However, these numbers can be useful in examining performance. If you wish to achieve 60 fps on a GeForce 3, the absolute top amount of vertices you can transform in a frame is 666,666. Let's say that every object you render requires two passes. The theoretical top you could transform is now halved to 333,333 vertices. Mind you, these vertices all belong to one object and are untextured and flat shaded, drawn as optimally as possible with absolutely nothing else happening in the application. No interesting game could ever hope to achieve this situation.
当然这些理论峰值并且不能代表真实游戏世界情况。但这些数字可以用来检查性能。如果你希望在GeForce 3上达到60fps.能够变换的一帧相对最大顶点数量是666,666。每个对象你需要渲染两次。能够变换顶点的理论最大值将减半为333,333. 注意:这些顶点都属于一个还未纹理化和平坦着色的对象,尽可能优化而且应用程序无任何情况发生。任何游戏都不可能发生这种情况。

Fill-Rate
填充率

Not only is a graphics card limited in the number of vertices it can transform, it is also limited in the number of pixels it can write to the backbuffer per second. The backbuffer is the portion of a graphics card's memory that is used as a scratch pad while the final image is being assembled. When this process of writing to the backbuffer exceeds the graphics card's capability, an application is described as being "fill-rate limited."
The following chart shows the maximum fill rate for various PC graphics hardware:

显卡不仅仅在变换顶点的数量方面受到限制, 而且每秒填充到后缓冲区的像素个数也受到了限制。后备缓冲区是显卡显存的一部分,做为正在组装的最终图像便签。当写入后备缓冲区操作超出显卡能力时,应用程序称为"填充率上限"
下图显示了不同PC显卡最大的填充率

Manufacturer & Card

 

Pixel fillrate - million pixel/sec

nVidia GeForce 3

800

nVidia GeForce 4 Ti

1200

nVidia GeForce FX

2000

nVidia GeForce 6800

6400

ATI Radeon 8500

1100

ATI Radeon 9700

2600

ATI Radeon X800

8300

These values are, of course, theoretical peaks and do not represent real-world game situations. However, these numbers can be useful in examining performance. Let's see what we can do with a GeForce 3 at a display resolution of 1024 by 768. We'll assume for the moment that transformation and lighting comes for free (which it never does). 1024 by 768 resolution is 786,432 pixels. We'd like to run at 60 fps, so that involves rendering that 1024 by 768 image 60 times for a grand total of 47.19 million pixels. Assuming each pixel is drawn more than once, the maximum number of pixel writes we can do on each pixel is roughly 17. This, of course, assumes that all operations that write a pixel cost the same. Multitexturing and the complexity of pixel shaders quickly lower this number. Overuse of complex pixel shaders can quickly make an application fill rate limited.
当然这些理论峰值并且不能代表真实游戏世界情况.但这些数字可以用来检查性能. 让我们看看我们在显示器分辨率1024*768的GeForce 3上能做什么。我们假定此时变换和光照操作免费(这不可能发生)。1024×768 分辨率表示786,432 个像素。我们希望以60fps运行。所以渲染1024×768分辨率图像60次将达到47.19 百万像素。假定每个像素被渲染不止一次,假定所有写入一个像素操作花费相同时间,我们在每个像素上写入的最大次数大约是17次 (800/47)。多纹理和复杂的像素shaders会降低这个数量。过度使用复杂的像素着色器会快速的达到应用程序填充率上限。

Clipping & Culling
裁剪和剔除

The clipping/culling behavior of Gamebryo is another issue that must be kept in mind when creating scene geometry.
当创建场景几何体时Gamebryo的裁切/剔除行为是另一个需要记在头脑中的问题

Clipping is the process of dividing polygons into only the fragments that will appear on screen.
裁切是将多边形分开成可以在屏幕上显示的片断的过程。

Culling is an attempt to avoid clipping by rejecting whole NiMesh objects if no part of them appears on the screen. In general, culling is preferable to clipping because clipping is vastly more expensive than culling.
如果物体的任何部分都不出现在屏幕上通过拒绝整个NiMesh对象显示来避免裁切就是剔除。总的来说,剔除比裁切更可取,因为裁切比剔除操作更加昂贵。

You can structure your scenes to improve culling by limiting the volume of space an NiMesh occupies. A small NiMesh is more likely to be completely off screen while a very large one (e.g. a huge floor) is likely to be, at least, partially on screen all the time.
通过限制NiMesh占据的空间体积,你可以在构造场景是提高剔除效率。一个小的NiMesh更可能完全离开屏幕而一个非常大的(例如巨型地板)很有可能,至少一部分一直在场景中。

Triangle/Mesh Ratios vs. Clipping & Culling
三角形/网格比值 VS 裁切和剔除

These two issues, the triangle/mesh ratio and the culling/clipping behavior, place somewhat contradictory demands on you. To improve the triangle/mesh ratio you must have the most triangles in a mesh possible (mesh collapsing, increasing the number of triangles in the mesh, etc.). Simultaneously, the meshes must be kept compact to allow for efficient culling. There is no simple solution to this problem and you must constantly balance the two constraints. In general, triangles should be grouped into meshes so that culling will still be effective, but the meshes should contain the most triangles possible.

For example, when modeling the four walls of a room, if the walls are relatively complex, each wall should be in its own mesh. Having all the walls in a single mesh would improve the triangle/mesh ratio but would force clipping on all the geometry. By dividing the walls into four meshes, two of them will usually be culled leaving the other two to be clipped. However, if the walls were very simple (i.e. 2 triangles each) then it might make sense to clump all the wall triangles together to avoid having several 2 triangle meshes.

In modern hardware, side plane clipping is avoided as much as possible through various tricks. Near plane clipping remains a problem, however.

对于这两个问题,三角形/网格比值和裁切/剔除形为,对于你来说处于某种对立的位置。为了改善三角形/网格比值,你必须尽可能让更多的三角形在一个网格中(折叠网格,增加网格中三角形的数量等等)。同时地,网格必须保持紧凑的以允许有效的剔除。对这个问题没有一个简单的解决办法,你必须自己在两个限制间找平衡。总的来说,三角形应该被组合到网格中,这样剔除仍然高效,但网格应该包含尽可能多的三角形。

例如,当为一个屋子的4面墙壁建模,如果墙壁相对较复杂,每个墙壁应该有它自己的网格。把所有的墙壁放入一个单独的网格中可以改善三角形/网格比值,但是将强迫裁切所有的几何体。通过将墙壁分成4个网格,它们中的两个将总是执行剔除操作,而留下另外两个执行裁切。然而,如果墙壁是非常简单的 (比如每个2个三角形)那么可以考虑将整个墙壁整合起来以避免出现几个拥有两个三角形的网格。

在现代的硬件中,侧平面(side plane)裁切可以通过多种多样的窍门尽可能避免,然而,近平面(near plane)裁切仍然是一个问题。

回應 (1)

請稍候...
很抱歉,您輸入的回應過長。請縮短您的回應。
您尚未輸入內容,請再試一次。
很抱歉,目前無法新增您的回應,請稍後再試。
若要新增回應,您的父母必須先給您權限。要求權限
您的家長已關閉回應功能。
很抱歉,目前無法刪除您的回應,請稍後再試。
您已超過每日回應上限次數,請於 24 小時後再試一次。
由於系統顯示您可能傳送垃圾郵件給其他使用者,因此您帳號中的回應功能已遭停用。 如果您認為自己帳號遭錯誤停用,請連絡 Windows Live 支援
請完成下列安全檢查,以完成回應。
您輸入的安全檢查字元必須與圖片或音訊中的字元相符。

若要新增回應,請以您的 Windows Live ID 登入 (若您使用 Hotmail、Messenger 或 Xbox LIVE,則您已擁有 Windows Live ID)。登入


沒有 Windows Live ID?註冊

10 月 21 日

引用通告

此內容的引用通告是:
http://topameng.spaces.live.com/blog/cns!F962D4854A8233D!451.trak
引述這則內容的部落格