creating_a_3d_particle_system.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. .. _doc_creating_3d_particle_system:
  2. Creating a 3D particle system
  3. -----------------------------
  4. .. figure:: img/particle_node_new.webp
  5. :align: right
  6. Required particle node properties
  7. To get started with particles, the first thing we need to do is add a ``GPUParticles3D``
  8. node to the scene. Before we can actually see any particles, we have to set up two parameters on the node:
  9. the ``Process Material`` and at least one ``Draw Pass``.
  10. The process material
  11. ~~~~~~~~~~~~~~~~~~~~
  12. To add a process material to your particles node, go to ``Process Material`` in the inspector panel.
  13. Click on the box next to ``Process Material`` and from the dropdown menu select ``New ParticleProcessMaterial``.
  14. .. figure:: img/particle_new_process_material.webp
  15. :align: right
  16. Creating a process material
  17. :ref:`class_ParticleProcessMaterial` is a special kind of material. We don't use it to draw any objects.
  18. We use it to update particle data and behavior on the GPU instead of the CPU, which comes with a massive performance
  19. boost. A click on the newly added material displays a long list of properties that you can set to
  20. control each particle's behavior.
  21. Draw passes
  22. ~~~~~~~~~~~
  23. .. figure:: img/particle_first_draw_pass.webp
  24. :align: right
  25. At least one draw pass is required
  26. In order to render any particles, at least one draw pass needs to be defined. To do that, go to
  27. ``Draw Passes`` in the inspector panel. Click on the box next to ``Pass 1`` and select ``New QuadMesh``
  28. from the dropdown menu. After that, click on the mesh and set its ``Size`` to 0.1 for both ``x``
  29. and ``y``. Reducing the mesh's size makes it a little easier to tell the individual particle
  30. meshes apart at this stage.
  31. You can use up to 4 draw passes per particle system. Each pass can render a different
  32. mesh with its own unique material. All draw passes use the data that is computed by the process material,
  33. which is an efficient method for composing complex effects: Compute particle
  34. behavior once and feed it to multiple render passes.
  35. .. figure:: img/particle_two_draw_passes.webp
  36. Using multiple draw passes: yellow rectangles (pass1) and blue spheres (pass 2)
  37. If you followed the steps above, your particle system should now be emitting particles in a waterfall-like fashion,
  38. making them move downwards and disappear after a few seconds. This is the foundation for all
  39. particle effects. Take a look at the documentation for :ref:`particle <doc_3d_particles_properties>` and
  40. :ref:`particle material <doc_process_material_properties>` properties to
  41. learn how to make particle effects more interesting.
  42. .. figure:: img/particle_basic_system.webp
  43. Particle conversion
  44. ~~~~~~~~~~~~~~~~~~~
  45. .. figure:: img/particle_convert_cpu.webp
  46. :align: right
  47. Turning GPU into CPU particles
  48. You can convert GPU particles to CPU particles at any time using the entry in the viewport
  49. menu. When you do so, keep in mind that not every feature of GPU particles is available for
  50. CPU particles, so the resulting particle system will look and behave differently from the
  51. original.
  52. You can also convert CPU particles to GPU particles if you no longer need to use CPU particles.
  53. This is also done from the viewport menu.
  54. Some of the most notable features that are lost during the conversion include:
  55. - multiple draw passes
  56. - turbulence
  57. - sub-emitters
  58. - trails
  59. - attractors
  60. - collision
  61. You also lose the following properties:
  62. - ``Amount Ratio``
  63. - ``Interp to End``
  64. - ``Damping as Friction``
  65. - ``Emission Shape Offset``
  66. - ``Emission Shape Scale``
  67. - ``Inherit Velocity Ratio``
  68. - ``Velocity Pivot``
  69. - ``Directional Velocity``
  70. - ``Radial Velocity``
  71. - ``Velocity Limit``
  72. - ``Scale Over Velocity``
  73. Converting GPU particles to CPU particles can become necessary when you want to release a game
  74. on older devices that don't support modern graphics APIs.