creating_a_3d_particle_system.rst 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. Some of the most notable features that are lost during the conversion include:
  53. - multiple draw passes
  54. - turbulence
  55. - sub-emitters
  56. - trails
  57. - attractors
  58. - collision
  59. Converting GPU particles to CPU particles can become necessary when you want to release a game
  60. on older devices that don't support modern graphics APIs.