index.rst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. .. _doc_3d_particles:
  2. Particle systems (3D)
  3. =====================
  4. This section of the tutorial covers (3D) GPU-accelerated particle systems. Most of the things
  5. discussed here apply to CPU particles as well.
  6. Introduction
  7. ------------
  8. You can use particle systems to simulate complex physical effects like fire, sparks,
  9. smoke, magical effects, and many more. They are very well suited for creating dynamic and organic
  10. behavior and adding "life" to your scenes.
  11. The idea is that a particle is emitted at a fixed interval and with a fixed lifetime. During
  12. its lifetime, every particle will have the same base behavior. What makes each particle different
  13. from the others and creates the organic look is the randomness that you can add to most of its
  14. parameters and behaviors.
  15. Every particle system you create in Godot consists of two main parts: particles and emitters.
  16. Particles
  17. ~~~~~~~~~
  18. A particle is the visible part of a particle system. It's what you see on the screen when a particle
  19. system is active: The tiny specks of dust, the flames of a fire, the glowing orbs of a magical
  20. effect. You can have anywhere between a couple hundred and tens of thousands of particles in a
  21. single system. You can randomize a particle's size, its speed and movement direction, and change its
  22. color over the course of its lifetime. When you think of a fire, you can think of all the little
  23. embers flying away from it as individual particles.
  24. Emitters
  25. ~~~~~~~~
  26. An emitter is what's creating the particles. Emitters are usually not visible, but they can have
  27. a shape. That shape controls where and how particles are spawned, for example whether they should fill
  28. a room like dust or shoot away from a single point like a fountain. Going back to the fire example,
  29. an emitter would be the heat at the center of the fire that creates the embers and the flames.
  30. Node overview
  31. ~~~~~~~~~~~~~
  32. .. figure:: img/particle_nodes.webp
  33. :alt: A list of nodes related to 3D particles
  34. :align: right
  35. All 3D particle nodes available in Godot
  36. There are two types of 3D particle systems in Godot: :ref:`class_GPUParticles3D`, which are processed on the GPU,
  37. and :ref:`class_CPUParticles3D`, which are processed on the CPU.
  38. CPU particle systems are less flexible than their GPU counterpart, but they work on a wider range of hardware and
  39. provide better support for older devices and mobile phones. Because they are processed on the CPU,
  40. they are not as performant as GPU particle systems and can't render as many individual particles.
  41. GPU particle systems run on the GPU and can render hundreds of thousands of particles on modern
  42. hardware. You can write custom particle shaders for them, which makes them very flexible. You can
  43. also make them interact with the environment by using attractor and collision nodes.
  44. There are three particle attractor nodes: :ref:`class_GPUParticlesAttractorBox3D`, :ref:`class_GPUParticlesAttractorSphere3D`,
  45. and :ref:`class_GPUParticlesAttractorVectorField3D`. An attractor node applies a force to all particles
  46. in its reach and pulls them closer or pushes them away based on the direction of that force.
  47. There are several particle collision nodes. :ref:`class_GPUParticlesCollisionBox3D` and
  48. :ref:`class_GPUParticlesCollisionSphere3D` are the simple ones. You can use them to create basic
  49. shapes like boxes, a floor, or a wall that particles collide with. The other two nodes provide
  50. more complex collision behavior. The :ref:`class_GPUParticlesCollisionSDF3D` is useful when you want
  51. indoor scenes to collide with particles without having to create all the individual box and sphere
  52. colliders by hand. If you want particles to collide with large outdoor scenes, you would use the
  53. :ref:`class_GPUParticlesCollisionHeightField3D` node. It creates a heightmap of your world and the
  54. objects in it and uses that for large-scale particle collisions.
  55. Basic usage
  56. -----------
  57. .. toctree::
  58. :maxdepth: 1
  59. :name: toc-particles-basic
  60. creating_a_3d_particle_system
  61. properties
  62. process_material_properties
  63. Advanced topics
  64. ---------------
  65. .. toctree::
  66. :maxdepth: 1
  67. :name: toc-particles-advanced
  68. subemitters
  69. trails
  70. turbulence
  71. attractors
  72. collision
  73. complex_shapes