ここでは、最適なパフォーマンスを実現するためのモデルを作成するためのヒントをいくつか紹介します。これらのヒントは、すべてのモデルに適用されるものもあれば、アニメーション化されたモデルにのみ適用されるものもあります。
これらのテクニックを使用すると、モデルのアニメーションとレンダリングのスピードを上げるのに役立ちますが、視覚的な忠実度と達成しようとしているリアルな効果が低下する可能性があります。すべての状況に対して、パフォーマンスの向上と視覚的なリアリズムの完璧なバランスを生み出すことができる 1 つの答えはありません。キャラクターやシーンの複雑さと必要とする全体的な見た目やリアリズムに応じて、完璧なバランスを見つける必要があります。
使用するポリゴンの数は、必要なビジュアル品質とターゲットとするプラットフォームによって異なります。以下 2 つの競合する事実は等しく当てはまります。
また、リソースのレンダリングに関して他に何が競合しているかを検討してみましょう。画面に同時に多くのゲームオブジェクトや Terrain (地形) オブジェクトがある場合は、メッシュごとのポリゴン数を減らすことを検討してください。
Note that the actual number of vertices that graphics hardware has to process is usually not the same as the number reported by a modelling application. Modeling applications usually display the number of distinct corner points that make up a model (known as the geometric vertex count). For a graphics card, however, some geometric vertices need to be split into two or more logical vertices for rendering purposes: for example, a vertex must be split if it has multiple normals, UV coordinates or vertex colors. Consequently, the vertex count in Unity is usually higher than the count given by the 3D application.
各モデルに使用する マテリアル の数は、できるだけ少なくしてください。1 つのキャラクターに複数のマテリアルを使用するのは、さまざまなパーツに異なるシェーダーを使用する必要がある場合のみにしてください。例えば、キャラクターモデルの目に特殊なシェーダーを使用する場合などです。
For animated character models that use a Skinned Mesh Renderer, you should use only one of these components per character. Unity’s animation system optimizes animation using visibility culling and bounding volume updates. It only activates these optimizations if you use one Animation component and one Skinned Mesh Renderer on a model.
1 つのメッシュの代わりに 2 つのスキンメッシュを使用すると、モデルのレンダリング時間が約 2 倍になり、複数のメッシュを使用することに実用的なメリットはほとんどありません。
一般に、使用するボーンの数が少ないほど、パフォーマンスは向上します。ただし、多くのボーンを持つキャラクターモデルを作成する必要がある場合があります。例えば、多くのカスタマイズ可能なアタッチメントが必要な場合などです。これらの余分のボーンはビルドのサイズを増加させ、余分のボーンが増えるごとに関連する処理コストを発生させる可能性があります。例えば、すでに 30 のボーンがあるリグに 15 の追加ボーンを加えると、Generic モードで解決するのに 50% より多くの操作が必要になります。それにより、解決に必要な時間に影響が出ます。
Generic と Humanoid タイプには追加のボーンがあることに注意してください。追加ボーンを使用してアニメーションを再生しない場合、処理コストはごくわずかです。添付ファイルが存在しないか非表示の場合、このコストはさらに低くなります。
For performance reasons, use linear blend skinning with a maximum of four influences per vertex. However, some 3D modeling applications allow more than four bones to influence vertices, so you have to weigh the performance cost against greater control.
Unity がアニメーションをインポートするとき、モデルのインバースキネマティクス (IK) ノードをフォワードキネマティクス (FK) にベイクするため、Unity は IK ノードをまったく必要としません。ただし、それらがモデルに残っている場合は、アニメーションには影響しませんが計算には加えられます。Unity または 3D モデリングアプリケーションで、重複する IK ノードを削除できます。IK ノードの削除を容易にするために、モデリング中は IK と FK の階層を分けておきます。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.