1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

えっ?MaterialLayerBlendでPerInstanceRandom使えないの?

1
Posted at

こんにちは、Backです。

実行環境

UnrealEngine5.3

前提

・ PerInstanceRandom
InstancedStaticMeshやHierarchicalInstancedStaticMeshといったインスタンスごとにランダム浮動小数値を出力するノードです。レベルに配置したオブジェクトのテクスチャや色を変えるのに便利ですね。

InstancedStaticMesh、HierarchicalInstancedStaticMeshとは何?という方はこちらをご覧ください。
https://unrealengine.hatenablog.com/entry/2019/06/09/213000

・ MateriaLayer
複数のテクスチャやプロパティをブレンドし、一つのマテリアルにすることができます。インスタンス化すると簡単にテクスチャやブレンド率を変更できます。
・ MarerialLayerBlend
BlendMaterialAttributes 表現式で設定された Input Bottom Layer と Input Top Layerのマスキング方法を設定できます。
https://dev.epicgames.com/documentation/ja-jp/unreal-engine/using-material-layers-in-unreal-engine

問題

PerInstanceRandomを使用して、ブレンドされたマテリアルをもつInstancedStaticMeshを生成するも、すべてのインスタンスのマテリアルが同じになりました。
スクリーンショット 2025-12-24 004534.png

試したこと

・マテリアル詳細パネルの「Used with Instanced Static Meshes」にチェックを入れる。
・Num Custom Data Floatsに1を入れる
・forloopの削除
・その他、関連しそうな設定の見直し
結局PerInstanceRandomはデフォルト値しか返しませんでした。

回避策

MaterialLayerの代わりに普通のマテリアルを使うとPerInstanceRandomはランダムな値を返しました。
スクリーンショット 2025-12-24 053434.png

最後に

根本的解決になっていませんが、数枚のテクスチャのブレンドを変更するぐらいならパフォーマンス面で致命的な問題になることは少ないと判断しています。

同様の現象でハマっている方の参考になれば幸いです。
ここまで読んでくださりありがとうございました!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?