#memo

indiedev太郎

フォーリッジとinstancedMeshについて

今まで一回も触ってなかった

Unreal Engine | フォリッジ インスタンス化メッシュ
Unreal Engine | Grass ツールのクイック スタート

野菜っぽい名前だけど、大量にメッシュを配置するツールで、かつ負担がないよという物っぽい
グラスツールの方はランドスケープありきみたいだけど、フォリッジはいつでも使い所さんがある

フォーリジで配置されたものはdrawcallが1に抑えられるみたいで、これはInstancedMeshというやつがそのそれらしい
要はフォーリジはInstancedMesh配置マネージャーみたいな物(だと思う)

とりあえずInstancedMeshは普通にBPで使えるのでやってみる
https://i.gyazo.com/e8051b6be7449e7fdecc224d4eb0bdf0.png
https://i.gyazo.com/848205f946be0ad2d6fe00f6fa9b2515.png
https://i.gyazo.com/df5c509d34ddd38b3cadbe3bfd502971.png

InstancedMeshComponentに対してInstanceをAddしてゆく、Instance毎にTransformationを持っている
スタティックメッシュ、これ同一メッシュはエンジン側で勝手にInstanceにしてくれて良いんじゃないかって思うんだけれど、なにかInstancedMeshデメリットあるはず

なんとなく思いついたのは、同一メッシュ扱いっぽいので、広域を同一Instanceにしてしまうと、オクルージョンカリングとかが死ぬんじゃないか問題

とはいえ植物以外にも、アーバンなシーンのほうがむしろパターンみたいなもの多いと思うので、完全に背景のメッシュは近場にあるなら全部まとめちゃって、フォーリッジ以外にも自作の配置用アクタ用意するの良さがあると思いました

https://i.gyazo.com/44218217543fe2cdb4791deac8a7b43d.gif
自分だけの野菜スポナをつくろう



追記

The limitations of instanced static meshes that I can recall are:
They cannot accept negative scale values (so no easy mirroring of meshes)
They cannot change the base materaial of the parent instance (but the "per instance random" material node may counteract this)
And (I think), they cannot be moved after runtime as the collision mesh will not move with it

とのことです、redditのURLを貼ると何故かおこられる