|
@@ -63,99 +63,89 @@ Global built-ins are available everywhere, including custom functions.
|
|
| in float **E** | A ``E`` constant (``2.718281``). Euler's number and a base of natural logarithm. |
|
|
| in float **E** | A ``E`` constant (``2.718281``). Euler's number and a base of natural logarithm. |
|
|
+-------------------+----------------------------------------------------------------------------------------+
|
|
+-------------------+----------------------------------------------------------------------------------------+
|
|
|
|
|
|
|
|
+Start and Process built-ins
|
|
|
|
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
+
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| Function | Description |
|
|
|
|
++=================================+================================================================================+
|
|
|
|
+| in float **LIFETIME** | Particle lifetime. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| in float **DELTA** | Delta process time. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| in uint **NUMBER** | Unique number since emission start. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| in uint **INDEX** | Particle index (from total particles). |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| in mat4 **EMISSION_TRANSFORM** | Emitter transform (used for non-local systems). |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| in uint **RANDOM_SEED** | Random seed used as base for random. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| inout bool **ACTIVE** | ``true`` when Particle is active, can be set ``false``. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| inout vec4 **COLOR** | Particle color, can be written to and accessed in mesh's vertex function. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| inout vec3 **VELOCITY** | Particle velocity, can be modified. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| inout mat4 **TRANSFORM** | Particle transform. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| inout vec4 **CUSTOM** | Custom particle data. Accessible from shader of mesh as **INSTANCE_CUSTOM**. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+| inout float **MASS** | Particle mass, intended to be used with attractors. Equals ``1.0`` by default. |
|
|
|
|
++---------------------------------+--------------------------------------------------------------------------------+
|
|
|
|
+
|
|
|
|
+.. note:: In order to use the ``COLOR`` variable in a StandardMaterial3D, set ``vertex_color_use_as_albedo``
|
|
|
|
+ to ``true``. In a ShaderMaterial, access it with the ``COLOR`` variable.
|
|
|
|
+
|
|
Start built-ins
|
|
Start built-ins
|
|
^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
-In order to use the ``COLOR`` variable in a StandardMaterial3D, set ``use_vertex_as_albedo``
|
|
|
|
-to ``true``. In a ShaderMaterial, access it with the ``COLOR`` variable.
|
|
|
|
-
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| Built-in | Description |
|
|
|
|
-+================================+==============================================================================+
|
|
|
|
-| in float **LIFETIME** | Particle lifetime. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in float **DELTA** | Delta process time. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **NUMBER** | Unique number since emission start. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **INDEX** | Particle index (from total particles). |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in mat4 **EMISSION_TRANSFORM** | Emitter transform (used for non-local systems). |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **RANDOM_SEED** | Random seed used as base for random. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART** | ``true`` when particle must restart (lifetime cycled). |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART_POSITION** | |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART_ROT_SCALE** | |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART_VELOCITY** | |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART_COLOR** | |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART_CUSTOM** | |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout bool **ACTIVE** | ``true`` when Particle is active, can be set ``false``. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout vec4 **COLOR** | Particle color, can be written to and accessed in mesh's vertex function. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout vec3 **VELOCITY** | Particle velocity, can be modified. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout mat4 **TRANSFORM** | Particle transform. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout vec4 **CUSTOM** | Custom particle data. Accessible from shader of mesh as **INSTANCE_CUSTOM**. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| out float **MASS** | Particle mass, use for attractors. |
|
|
|
|
-+--------------------------------+------------------------------------------------------------------------------+
|
|
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
+| Built-in | Description |
|
|
|
|
++=================================+=============+
|
|
|
|
+| in bool **RESTART_POSITION** | |
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
+| in bool **RESTART_ROT_SCALE** | |
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
+| in bool **RESTART_VELOCITY** | |
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
+| in bool **RESTART_COLOR** | |
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
+| in bool **RESTART_CUSTOM** | |
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
+| in bool **RESTART_VELOCITY** | |
|
|
|
|
++---------------------------------+-------------+
|
|
|
|
|
|
Process built-ins
|
|
Process built-ins
|
|
^^^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| Built-in | Description |
|
|
|
|
-+=================================+==============================================================================+
|
|
|
|
-| in float **LIFETIME** | Particle lifetime. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in float **DELTA** | Delta process time. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **NUMBER** | Unique number since emission start. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **INDEX** | Particle index (from total particles). |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in mat4 **EMISSION_TRANSFORM** | Emitter transform (used for non-local systems). |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **RANDOM_SEED** | Random seed used as base for random. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **RESTART** | ``true`` when particle must restart (lifetime cycled). |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **FLAG_EMIT_POSITION** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **FLAG_EMIT_ROT_SCALE** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **FLAG_EMIT_VELOCITY** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **FLAG_EMIT_COLOR** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in uint **FLAG_EMIT_CUSTOM** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in bool **COLLIDED** | ``true`` when particle is collided with particle collider. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in vec3 **COLLISION_NORMAL** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in float **COLLISION_DEPTH** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| in vec3 **ATTRACTOR_FORCE** | |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout bool **ACTIVE** | ``true`` when Particle is active, can be set ``false``. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout vec4 **COLOR** | Particle color, can be written to and accessed in mesh's vertex function. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout vec3 **VELOCITY** | Particle velocity, can be modified. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout mat4 **TRANSFORM** | Particle transform. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| inout vec4 **CUSTOM** | Custom particle data. Accessible from shader of mesh as **INSTANCE_CUSTOM**. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
-| out float **MASS** | Particle mass, use for attractors. |
|
|
|
|
-+---------------------------------+------------------------------------------------------------------------------+
|
|
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| Built-in | Description |
|
|
|
|
++====================================+=========================================================================================================================================+
|
|
|
|
+| in uint **FLAG_EMIT_POSITION** | A flag for using on the last argument of ``emit_subparticle`` function to assign a position to a new particle's transform. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in uint **FLAG_EMIT_ROT_SCALE** | A flag for using on the last argument of ``emit_subparticle`` function to assign the rotation and scale to a new particle's transform. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in uint **FLAG_EMIT_VELOCITY** | A flag for using on the last argument of ``emit_subparticle`` function to assign a velocity to a new particle. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in uint **FLAG_EMIT_COLOR** | A flag for using on the last argument of ``emit_subparticle`` function to assign a color to a new particle. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in uint **FLAG_EMIT_CUSTOM** | A flag for using on the last argument of ``emit_subparticle`` function to assign a custom data vector to a new particle. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in bool **COLLIDED** | ``true`` when the particle has collided with a particle collider. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in vec3 **COLLISION_NORMAL** | A normal of the last collision. If there is no collision detected it is equal to ``vec3(0.0)``. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in float **COLLISION_DEPTH** | A length of normal of the last collision. If there is no collision detected it is equal to ``0.0``. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+| in vec3 **ATTRACTOR_FORCE** | A combined force of the attractors at the moment on that particle. |
|
|
|
|
++------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
+
|
|
|
|
+Process functions
|
|
|
|
+^^^^^^^^^^^^^^^^^
|
|
|
|
+
|
|
|
|
++--------------------------------------------------------------------------------------------+-----------------------------------------------+
|
|
|
|
+| Function | Description |
|
|
|
|
++============================================================================================+===============================================+
|
|
|
|
+| bool **emit_subparticle** (mat4 xform, vec3 velocity, vec4 color, vec4 custom, uint flags) | Forces to emit a particle from a sub-emitter. |
|
|
|
|
++--------------------------------------------------------------------------------------------+-----------------------------------------------+
|