SpeedTree アセット (Unity 版の SpeedTree Modeler によって保存された .SPM ファイル) は、他のアセットと同じように Unity によって認識されインポートされます。プロジェクトフォルダーのテクスチャがアクセス可能で、各 LOD のマテリアルが自動的に生成されるようにしておきます。.SPM アセットを選択するときインポート設定があり、生成したゲームオブジェクトとマテリアルを微調整できます。再インポートしても、 Generate Materials か Apply & Generate Materials ボタンを押さない限りマテリアルは再生成されません。そのため、マテリアルのすべてのカスタマイズは維持されます。
SpeedTree インポーターは結局は、LODGroup コンポーネント が設定されたプレハブを生成します。プレハブは、シーン内で一般的なプレハブインスタンスとしてインスタンス化することも、テレインのツリープロトタイプとして選択して、テレイン全体に描画することもできます。さらに、テレインはツリープロトタイプとして LODGroup コンポーネントを持つゲームオブジェクトはすべて受け入れ、使用されているメッシュサイズやマテリアルの数に制限はありません (Tree エディター のツリー) とは対照的に)。しかし、SpeedTreeのツリーでは通常 3〜4 種類のマテリアルを使用しているため、フレームごとに多数のドローコールが発生するため、ドローコール数に制限があるプラットフォームでは LOD ツリーの多用を避ける必要があります 。
ビルボードで正しく投影するために、シャドウキャスターパスの間、ビルボードはカメラに正面を向けるのではなく、光の方向に (ポイントライトの場合は、光のある位置に) 正面を向けます。
オプションを有効にするために、.spm アセットのインスペクターで Billboard LOD レベルを選択し、Billboard Options の Cast Shadows か Receive Shadows をチェックし、Apply Prefab を押します。
インスタンス化した SpeedTree ゲームオブジェクトのビルボードシャドウオプションを変更するには、Hierarchy ウィンドウで Billboard オブジェクトを選択し、普通のメッシュレンダラーでするのと同じように、これらのオプションを Billboard Renderer の Inspector で微調整します。
テレインでペイントされたツリーは、プレハブからビルボードシャドウオプションを継承します。
BillboardRenderer.shadowCastingMode
と BillboardRenderer.receiveShadows
を使って、ランタイムにそれらのオプションを変えることができます。
報告されている問題: 据え置きレンダリングの間、他のどんなレンダラーを使っても Receive Shadows オプションの効果がないため、ビルボードは常に据え置きパスでシャドウを受信します。
ビルボードのバッチパフォーマンスが 5.3 で向上しました。ビルボードの動的バッチコードを実行するために複数のコアが使用されています。
バッチ理論が簡易化されました。実用的には、ビルボードはほとんどバッチを共有しないため、現在、1つのバッチは 1つのタイプのビルボードしか呼び出しません。この変更に関してはSpeedTreeBillboard.shader
を参照してください。以前のビヘイビアによって、シェーダーを改正する必要があることがあります。
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.