using_multi_mesh_instance.rst 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .. _doc_using_multi_mesh_instance:
  2. Using MultiMeshInstance
  3. -----------------------
  4. Introduction
  5. ~~~~~~~~~~~~
  6. In a normal scenario you would use a :ref:`MeshInstance <class_MeshInstance>` 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 favourable to rapid iterations. :ref:`MultiMeshInstance <class_MultiMeshInstance>` is one of the possible solutions to this problem.
  7. MultiMeshInstance, 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 random scales and orientations.
  8. Setting up the nodes
  9. ~~~~~~~~~~~~~~~~~~~~
  10. The basic setup requires three nodes. Firstly, the multiMeshInstance node. Then, two MeshInstance nodes.
  11. One node is used as the target, the mesh that you want to place multiple meshes on. In the tree example, this would be the landscape.
  12. Another node is used as the source, the mesh that you want to have duplicate. In the tree case, this would be the tree.
  13. In our example, we would use a :ref:`Node <class_Node>` as the root node of the scene. Your scene tree would look like this:
  14. .. image:: img/multimesh_scene_tree.png
  15. .. note:: For simplification purpose, this tutorial would use built-in primitives.
  16. Now you have everything ready. Select the MultiMeshInstance 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.
  17. .. image:: img/multimesh_toolbar.png
  18. .. image:: img/multimesh_settings.png
  19. MultiMesh Settings
  20. ~~~~~~~~~~~~~~~~~~
  21. Below are descriptions of the options.
  22. Target Surface
  23. ++++++++++++++
  24. The mesh you would be using as the target surface for placing copies of you source mesh on.
  25. Source Mesh
  26. +++++++++++
  27. The mesh you want duplicated on the target surface.
  28. Mesh Up Axis
  29. ++++++++++++
  30. The axis used as the up axis of the source mesh.
  31. Random Rotation
  32. +++++++++++++++
  33. Randomizing the rotation around the mesh up axis of the source mesh.
  34. Random Tilt
  35. +++++++++++
  36. Randomizing the overall rotation of the source mesh.
  37. Random Scale
  38. ++++++++++++
  39. Randomizing the scale of the source mesh.
  40. Scale
  41. +++++
  42. The scale of the source mesh that will be placed over the target surface.
  43. Amount
  44. ++++++
  45. The amount of mesh instances placed over the target surface.
  46. Select the target surface, in the tree case, this should be the landscape node. And the source mesh should be the tree node. Adjust the other parameters according to your preference. Press ``Populate`` and multiple copies of the source mesh will be placed over the target mesh. If you are satisfied with the result, you can delete the mesh instance used as the source mesh.
  47. The end result should look like this:
  48. .. image:: img/multimesh_result.png
  49. To change the result, repeat the same step with different parameters.