個人檔案Quake3 启示录相片部落格清單更多 ![]() | 說明 |
|
7月11日 Gamebryo/Artist's Guides/Gamebryo 3ds max Plug in/Geometry and Performance(II)Grouping and 3ds Max As with Multi/Sub-Object materials, grouping should be used with care. Everything in a scene in Max has a corresponding node in its scene graph. In Gamebryo, that node is called an NiNode. An NiMesh represents a group of triangles while an NiNode contains a list of children and a list of transforms. Whenever a collection of objects in Max is grouped, the Gamebryo 3ds max plug-in has to add another NiNode to group them together in Gamebryo. Indiscriminate use of grouping can have a significant effect on the triangle/mesh ratio. In general, a high-triangle single object has much better frame-rate performance then many objects grouped together. 同使用Multi/Sub-Object材质一样,群组应该小心使用。在Max场景中的每个东西都有一个对应的节点在它的场景图中。在Gamebryo中,这个节点称为NiNode。一个NiMesh描述了一组三角形而一个 NiNode 包含了一个子结点列表以及一个变换列表。无论何时物体的集合在Max中被群组化,Gamebryo 3ds max插件必须加入另一个NiNode 将它们在Gamebryo中组合起来。 不加选择的应用群组会对triangle/mesh ratio比率产生重大的影响。总的来说,一个复杂三角形单一对象比许多对象群组在一起,在帧速率上可以获得更好的性能。 Skinning & Morphing with 3ds Max Skinning for Artists There are a few important bits of hardware knowledge that a character animator and modeler should be aware of before jumping into skinning a character. The hardware skinning pipeline is broken into two important numbers, the maximum number of bones the hardware can handle and the maximum number of bones that can influence a vertex. Each number has an important role to play in determining how your skinned character will perform in a game. The maximum number of bones the hardware can handle by default for most platforms is four. What exactly does this mean? Four is a really small number for a character. Behind the scenes, Gamebryo will break the skinned mesh apart into pieces that obey this limit. These pieces are referred to as skin partitions. For each partition we generate, we have to render the partition's geometry in a separate rendering call. For instance, a skinned character with 28 bones could be broken into 23 partitions in order to obey the maximum bone limit. This means that we are rendering the model in 23 separate pieces. Furthermore, each partition can only be composed of the vertices that use only those bones. If you're not careful in your weight assignments, you could end up with a partition with only one triangle! The maximum number of bones influencing a vertex by default on most platforms is also four. This means that a vertex that is influenced by five or more bones will only use the four most influential bones in its skinning. This may result in cracks in sections where many bones come together like the back of the neck and the crotch. Careful modeling and weight assignment will help to minimize this problem. This does not mean that you should always use four bones per vertex. In fact, it is best to use as few weights as are visually acceptable per vertex. This will help substantially when partitioning the mesh because more vertices will be able to fit into a partition. What should you take away from this discussion? First off, how you skin your character will directly transfer into performance for that character. Listed below are some useful hints on how to analyze your skinning performance and tips for getting good performance in general.
Physique vs. Skin modifier The Gamebryo Max Plug-in supports the two major modifiers for skinning. We have found the recent versions of Skin to be more reliable and robust then Physique, even when applied to bipeds, however both are supported. Gamebryo doesn't support floating bones for physique. If your model requires this capability, we suggest modeling with Skin instead of physique. In the Physique Level-Of-Detail panel, we only support Rigid Skin Update. When using Deformable, the exporter treats it like Rigid. Linking your skinned object Do not attach a skin to a bone in the hierarchy below that to which the skin is bound. This causes the mesh to translate twice, once for the skin binding and another for the child translation. You can create a node above the Bip01or base node to which the skin is attached, or use a character node to organize a bone structure and skin together. The mesh that has the Skin or Physique modifier uses the bones to determine its bounding volume. The hierarchy is updated by a depth-first traversal of the scene. If the skin occurs before the bones in a depth first traversal of the scene, the skin's bounding volume will lag one frame. Move the skin so that it occurs after the bone hierarchy in a depth first traversal to avoid this problem. Scaling your skinned object Do not scale a mesh after binding. If you scale a mesh you must unbind it first and rebind it after it has been properly scaled and translated. Scale it first and reset its transforms before you bind it to the bone system for best results. Morph and Skin work together Even though we support combining skin & morph targets we do not suggest it. If you want to make a character have facial animation morph targets, detach the head from the rest of the body and have it attached to the head bone as a direct link. The head mesh can use a morph target and translate via its relation with the head bone while the body uses a skin or physique modifier. When both modifiers are combined on a mesh it is much slower as all the vertices are being transformed twice, once in software and once in hardware. Please take this into consideration when making characters that have facial expression. See the section on Morphing Faces on Skinned Characters for more information. Morph Targets The Morph Modifier and Morph compound object are both supported in Gamebryo. We have found the Morph Modifier more reliable then the compound object in Max. Morph is inherently slower than skinning due to the fact that morphing is still done in software. However, there are many things that are easier to do with morph targets than with bone movement. Suggested uses for Morph targets are things like animated flags, facial expression and non-uniform scales. Instancing with Skinning and Morphing Objects that are skinned or morphed are exported such that clones (instances) are independently controlled and animated. However, when the Mesh Instancing tool plug-in is used, CPU skinned and morphed objects that are instances or exact copies in the Max scene will be exported as hardware instances. As a result, there is only one animated object and every other instance appears exactly the same. Move CPU skinned and morphed instances to another Max scene or use export selected to prevent this behavior when using the Mesh Instancing plug-in. Reading Skin Analyizer Plug-in Output The following section is a sample output from the skin analyzer plug-in. The model was broken into 23 partitions out of 28 bones. This model will likely perform moderately well. The key problems come around partition 19 in the list. Here we drop below 40 triangles per partition. At this point we are paying a fair amount of overhead for 6 partitions that don't have that many triangles in them. DirectX especially pays for this overhead. Often, this is unavoidable in modeling as some sections are the nexus of many bones and will be prone to small partitions (the neck and groin in particular). In general, the thing to be wary of is when the number of partitions exceeds the number of bones. This is horrible for performance because it also means that many of the partitions are incredibly small. Listed below the main chunk of text is a breakdown of each partition. This lists the bones involved in that partition and what the average weights were for that bone. This text can often be useful in pinpointing problem vertices since the bones in that partition would influence them Cloning and Instancing with 3ds Max 3ds Max中的克隆和实例 Instanced objects in Max are shared in Gamebryo as well. This technique can be extremely useful on memory-starved consoles. Note: If you adjust the pivot or non-uniform scale of an instance, it will become unique. Uniform scale is supported, but non-uniform scale cannot work with instances in Gamebryo because non-uniform scale is baked into the geometry. It should also be noted that instanced objects in Gamebryo must share the same material, unlike in Max. Instanced objects that need different materials should be made unique. Non-Uniform & Uniform Scale 不均匀和均匀缩放 Gamebryo does not support animating non-uniform scales (i.e. scales with different values in the x, y, and z axes). Animating non-uniform scale is not supported and will be treated like a uniform scale when animating. All static non-uniform scales are baked into the geometry data itself. If you need to have something non-uniformly scaled or squashed, use a morph target to achieve the action. Morph targets can be created by squashing an object in 3ds max and using Tools / Snapshot to grab a desired morph target. Gamebryo不支持动画不均匀的缩放(比如在x,y和z轴上有不同的缩放比例) 。动画的不均匀缩放是不支持的并且在动画中做为等比例缩放的方式来处理。所有静态的不均匀缩放会烘培到几何数据本身。 如果你需要使某些东西非等比例的缩放或者挤压,应用变形动画修改器对象(morph target)来完成这个任务。变形对象(morph target)可以在3ds max中通过挤压来制作,并应用Tools/Snapshot来获取一个想要的变形体对象(morph target)。 Multi/Sub-Object and Triangle/Mesh Ratios Multi/Sub-对象 和 Triangle/Mesh 比率 A convenient way of texturing an object in Max is to use the Multi/Sub-Object material. However, Gamebryo only supports one material per mesh because most hardware can only handle one material per set of triangles. When the Gamebryo 3ds max Plug-in encounters a Multi/Sub-Object material it must split the Max Mesh into multiple NiMesh objects (one for each material). 在Max中贴图一个对象便利的方法是应用Multi/Sub-Object 材质。然而,Gamebryo只支持每个网格一个材质,因为大部分硬件只能为一个三角形集合处理一个材质。当 Gamebryo 3ds max 插件遇到一个Multi/Sub-Object材质,它必须将Max网格分开成多个NiMesh 对象 (每个网格对应一个材质)。 Over-use of Multi/Sub-Objects is the most common offender in terms of performance in most data sets support receives. If used indiscriminately, Multi/Sub-Object materials can lay waste to the triangle/mesh ratio and you end up with a single object made of many little pieces. Multi/Sub-Object materials do not need to be completely avoided but they should be used cautiously and with a consideration of the triangle/mesh ratio constraints. When doing characters and discreet objects, the concept of a single texture 'Skin' for the subject is recommended. Multiple UVs, Smoothing Groups and Vertices 多重 UVs,平滑群组和顶点 Another geometric concern is Max's Mesh representation itself. Max can have more than one normal and UV (within a single UV channel) per vertex while real-time engines cannot. To resolve this incompatibility our 3ds max Plug-in will add additional vertices so that the NiMesh created has only one normal and UV per vertex. The NiMesh will look the same as the Max Mesh but will have more vertices. This vertex bloat will push the transform-rate but it is seldom a big problem. Using a lot of smoothing groups or complicated UV Mappings will make the problem worse but some vertex bloat is unavoidable. Having things smooth is faster than having things flat shaded. Vertexbloat.max is also a good example of this phenomenon. A 120-triangle sphere with 1 smoothing group has 62 vertices and a flat or un-shaded version has 358 vertices. 另一个几何上的关注点是Max网格描述本身。Max每个顶点可以拥有超过一个的法线和UV (带一个单独的UV通道) 而实时的引擎却不可以。为解决这种不兼容性的3ds max 插件加入了额外的顶点,所以创建的NiMesh每个顶点只有唯一的法线及UV。NiMesh 看上去将和Max中网格一样但它拥有更多的顶点。这种顶点膨胀将给变换速率造成负担,但是它不是一个大问题。应用很多平滑群组或者复杂的UV Mappings将会加重这个问题,但是一些顶点的膨胀是无法避免的。 使物体原滑比使他们平坦着色更快些。 Vertexbloat.max也是这个现象的很好的例子。一个120三角面的球带一个平滑的群组拥有62个顶点而一个平坦或者无着色的版本有358个顶点。
Mesh Profile Custom Attribute Every piece of geometry has a Mesh Packing Profile associated with it. This is used by the Packer tool plug-in to create the platform-specific geometry streams used by the graphics card. Depending on the situation, it can be necessary for a specific mesh to override the scene default packing profile and use its own profile. To override the scene default packing profile one would click on the "Add/Remove Mesh Profile attribute" button to add a Mesh Profile Attribute to the selected mesh. For additional information on mesh profiles see Introduction to Mesh Profiles. Precache Custom Attributes
These custom attributes tell the Gamebryo renderers how to treat an object once they have created the platform-specific versions of it. Creating the platform-specific version is called "pre-caching" the object. In some cases it may be useful for applications to keep information lying around after it has been "pre-cached". As an important example, triangle-triangle collision detection will not work if the triangles are thrown away once the renderer has pre-cached its data. Typically, artists will not need to add these attributes, since any application that pre-caches geometry, can set the "Keep" flags to hold on to data that is needed, as well. The UI exists so that advanced users can have complete control over how specific art assets are used by the renderers. These flags can be added through the user-interface via the Gamebryo toolbar. Click on the "Add/Remove Precache flags" icon. 这些定制属性告诉Gamebryo渲染器,在创建平台细节的版本时如何对待对象。创建具体平台版本称为"pre-caching"对象。在某些情况下,应用程序在"pre-cached"之后,保持闲置信息是十分有用的。 这些标志这些标志可以通过用户界面的 Gamebryo toolbar 加入。点击 "Add/Remove Precache flags" 图标。 Geometry Data Consistency This radio button allows you to set how the renderer treats the data at runtime. "Default" sets the consistency to whatever Gamebryo best determines the data to be. "Static" means that once the data is in the renderer it will never change. This is a good setting for set pieces like buildings. "Mutable" means that the object may change from time to time. This would be useful for an application effect like changing a car's geometry to reflect hits it has taken on the road while driving. "Volatile" means that the object changes every frame. This setting is best set for when you are changing vertex colors on the fly or manually animating the UV coordinates. Data To Preserve These check boxes allow the user to set which data is kept around after the "pre-cache" has occurred. 这些复选框允许用户设定哪些数据在 "pre-cache"后需要保留下来。 回應 (2)
引用通告此內容的引用通告是: http://topameng.spaces.live.com/blog/cns!F962D4854A8233D!442.trak 引述這則內容的部落格
|
|
|