using_multi_mesh_instance.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. :article_outdated: True
  2. .. _doc_using_multi_mesh_instance:
  3. Using MultiMeshInstance3D
  4. -------------------------
  5. Introduction
  6. ~~~~~~~~~~~~
  7. In a normal scenario, you would use a :ref:`MeshInstance3D <class_MeshInstance3D>`
  8. node to display a 3D mesh like a human model for the main character, but in some
  9. cases, you would like to create multiple instances of the same mesh in a scene.
  10. You *could* duplicate the same node multiple times and adjust the transforms
  11. manually. This may be a tedious process and the result may look mechanical.
  12. Also, this method is not conducive to rapid iterations.
  13. :ref:`MultiMeshInstance3D <class_MultiMeshInstance3D>` is one of the possible
  14. solutions to this problem.
  15. MultiMeshInstance3D, as the name suggests, creates multiple copies of a
  16. MeshInstance over a surface of a specific mesh. An example would be having a
  17. tree mesh populate a landscape mesh with trees of random scales and orientations.
  18. Setting up the nodes
  19. ~~~~~~~~~~~~~~~~~~~~
  20. The basic setup requires three nodes: the MultiMeshInstance3D node
  21. and two MeshInstance3D nodes.
  22. One node is used as the target, the surface mesh that you want to place multiple meshes
  23. on. In the tree example, this would be the landscape.
  24. The other node is used as the source, the mesh that you want to have duplicated.
  25. In the tree case, this would be the tree itself.
  26. In our example, we would use a :ref:`Node3D <class_Node3D>` node as the root node of
  27. the scene. Your scene tree would look like this:
  28. .. image:: img/multimesh_scene_tree.png
  29. .. note:: For simplicity's sake, this tutorial uses built-in primitives.
  30. Now you have everything ready. Select the MultiMeshInstance3D node and look at the
  31. toolbar, you should see an extra button called ``MultiMesh`` next to ``View``.
  32. Click it and select *Populate surface* in the dropdown menu. A new window titled
  33. *Populate MultiMesh* will pop up.
  34. .. image:: img/multimesh_toolbar.png
  35. .. image:: img/multimesh_settings.png
  36. MultiMesh settings
  37. ~~~~~~~~~~~~~~~~~~
  38. Below are descriptions of the options.
  39. Target Surface
  40. ++++++++++++++
  41. The mesh used as the target surface on which to place copies of your
  42. source mesh.
  43. Source Mesh
  44. +++++++++++
  45. The mesh you want duplicated on the target surface.
  46. Mesh Up Axis
  47. ++++++++++++
  48. The axis used as the up axis of the source mesh.
  49. Random Rotation
  50. +++++++++++++++
  51. Randomizing the rotation around the up axis of the source mesh.
  52. Random Tilt
  53. +++++++++++
  54. Randomizing the overall rotation of the source mesh.
  55. Random Scale
  56. ++++++++++++
  57. Randomizing the scale of the source mesh.
  58. Scale
  59. +++++
  60. The scale of the source mesh that will be placed over the target surface.
  61. Amount
  62. ++++++
  63. The amount of mesh instances placed over the target surface.
  64. Select the target surface. In the tree case, this should be the landscape node.
  65. The source mesh should be the tree node. Adjust the other parameters
  66. according to your preference. Press ``Populate`` and multiple copies of the
  67. source mesh will be placed over the target mesh. If you are satisfied with the
  68. result, you can delete the mesh instance used as the source mesh.
  69. The end result should look like this:
  70. .. image:: img/multimesh_result.png
  71. To change the result, repeat the previous steps with different parameters.