index.rst 4.4 KB

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