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

Introducción

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.

Configurando los nodos

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.

El otro nodo se usa como la fuente, la malla que quieres que se duplique. En el caso del árbol, este sería el árbol mismo.

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

Nota

Para simplificar, este tutorial utiliza primitivas integradas.

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

Configuración de MultiMesh

A continuación se describen las opciones.

Superficie del objetivo

La malla utilizada como la superficie de destino en la que colocar las copias de la malla de origen.

Malla de la fuente

La malla que quieres que se duplique en la superficie del objetivo.

El eje de la malla

El eje utilizado como eje ascendente de la malla de la fuente.

Rotación aleatoria

Aleatorizando la rotación alrededor del eje ascendente de la malla de la fuente.

Inclinación aleatoria

Aleatorizando la rotación general de la malla de la fuente.

Escala aleatoria

Aleatorizando la escala de la malla de la fuente.

Escala

La escala de la malla de la fuente que se colocará sobre la superficie del objetivo.

Cantidad

La cantidad de instancias de malla colocadas sobre la superficie del objetivo.

La cantidad de instancias de malla colocadas sobre la superficie del objetivo.

El resultado final debería ser así:

../../_images/multimesh_result.png

Para modificar el resultado, repite el mismo paso previo con parámetros diferentes.