Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tutorials/shaders/shader_reference/particle_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ or Spatial, depending on whether they are 2D or 3D.

Particle shaders are unique because they are not used to draw the object itself;
they are used to calculate particle properties, which are then used by a
:ref:`CanvasItem<doc_canvas_item_shader>` or :ref:`Spatial<doc_spatial_shader>`
:ref:`CanvasItem<doc_canvas_item_shader>` or :ref:`Spatial<doc_spatial_shader>`
shader. They contain two processor functions: ``start()`` and ``process()``.

Unlike other shader types, particle shaders keep the data that was output the
Expand Down Expand Up @@ -80,6 +80,11 @@ Start and Process built-ins

These properties can be accessed from both the ``start()`` and ``process()`` functions.

When using the built-in :ref:`class_ParticleProcessMaterial`, ``USERDATA1`` is defined
with the following value in the built-in:

* **w**: Accumulated angle from angular velocity in radians, as applied by the angular velocity texture.

+------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Function | Description |
+====================================+=========================================================================================================================================+
Expand Down
6 changes: 3 additions & 3 deletions tutorials/shaders/shader_reference/spatial_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ However, the value passed to the fragment shader still comes from ``VERTEX``.
For instancing, the ``INSTANCE_CUSTOM`` variable contains the instance custom data. When using particles, this information
is usually:

* **x**: Rotation angle in radians.
* **y**: Phase during lifetime (``0.0`` to ``1.0``).
* **z**: Animation frame.
* **x**: Current rotation angle in radians.
* **z**: Current animation frame.
* **y / w** (division): Lifetime fraction from 0.0 to 1.0.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm.

Suggested change
* **y / w** (division): Lifetime fraction from 0.0 to 1.0.
* **y / w** (division): Lifetime fraction from ``0.0`` to ``1.0``.


This allows you to easily adjust the shader to a particle system using default particle material. When writing a custom particle
shader, this value can be used as desired.
Expand Down
Loading