Work in progress

The content of this page was not yet updated for Godot 4.2 and may be outdated. If you know how to improve this page or you can confirm that it's up to date, feel free to open a pull request.

Using MultiMeshInstance3D

はじめに

In a normal scenario, you would use a MeshInstance3D node to display a 3D mesh like a human model for the main character, but in some cases, you would like to create multiple instances of the same mesh in a scene. You could duplicate the same node multiple times and adjust the transforms manually. This may be a tedious process and the result may look mechanical. Also, this method is not conducive to rapid iterations. MultiMeshInstance3D is one of the possible solutions to this problem.

MultiMeshInstance3D, as the name suggests, creates multiple copies of a MeshInstance over a surface of a specific mesh. An example would be having a tree mesh populate a landscape mesh with trees of random scales and orientations.

ノードのセットアップ

The basic setup requires three nodes: the MultiMeshInstance3D node and two MeshInstance3D nodes.

One node is used as the target, the surface mesh that you want to place multiple meshes on. In the tree example, this would be the landscape.

もう一方のノードは、複製するメッシュのソースとして使用されます。ツリーの場合、これはツリー自体になります。

In our example, we would use a Node3D node as the root node of the scene. Your scene tree would look like this:

../../_images/multimesh_scene_tree.png

注釈

簡単にするために、このチュートリアルでは組み込みのプリミティブを使用します。

Now you have everything ready. Select the MultiMeshInstance3D node and look at the toolbar, you should see an extra button called MultiMesh next to View. Click it and select Populate surface in the dropdown menu. A new window titled Populate MultiMesh will pop up.

../../_images/multimesh_toolbar.png ../../_images/multimesh_settings.png

マルチメッシュの設定

以下にオプションの説明を示します。

ターゲットサーフェス

ソース メッシュのコピーを配置するターゲット サーフェスとして使用されるメッシュ。

ソースメッシュ

ターゲット サーフェスに複製するメッシュ。

メッシュの上軸

ソースメッシュの上軸として使用される軸。

ランダムな回転

ソースメッシュの上軸周りの回転をランダム化します。

ランダムな傾き

ソースメッシュの全体的な回転をランダム化します。

ランダムな縮尺

ソースメッシュのスケールをランダム化します。

スケール

ターゲットサーフェス上に配置されるソースメッシュのスケール。

ターゲットサーフェス上に配置されるメッシュインスタンスの量。

ターゲットサーフェスを選択します。ツリーの場合、これはランドスケープノードである必要があります。ソースメッシュはツリーノードである必要があります。好みに応じて他のパラメーターを調整します。データの投入 を押すと、ソースメッシュの複数のコピーがターゲットメッシュ上に配置されます。結果に満足したら、ソースメッシュとして使用されているメッシュインスタンスを削除できます。

最終結果は次のようになります:

../../_images/multimesh_result.png

結果を変更するには、異なるパラメーターを使用して前の手順を繰り返します。