Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update description of shader variable TIME and add description to Fog, Particle, Sky, and Spatial shader pages #9734

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
38 changes: 20 additions & 18 deletions tutorials/shaders/shader_reference/canvas_item_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,26 @@ Global built-ins

Global built-ins are available everywhere, including custom functions.

+-------------------+----------------------------------------------------------------------------------------+
| Built-in | Description |
+===================+========================================================================================+
| in float **TIME** | Global time since the engine has started, in seconds (always positive). |
| | It's subject to the rollover setting (which is 3,600 seconds by default). |
| | It's not affected by :ref:`time_scale<class_Engine_property_time_scale>` |
| | or pausing, but you can define a global shader uniform to add a "scaled" |
| | ``TIME`` variable if desired. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ration of circle's circumference to its diameter and amount of radians in half turn. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **TAU** | A ``TAU`` constant (``6.283185``). |
| | An equivalent of ``PI * 2`` and amount of radians in full turn. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **E** | An ``E`` constant (``2.718281``). |
| | Euler's number and a base of the natural logarithm. |
+-------------------+----------------------------------------------------------------------------------------+
+-------------------+-----------------------------------------------------------------------------------------+
| Built-in | Description |
+===================+=========================================================================================+
| in float **TIME** | Global time since the engine has started, in seconds. It repeats after every 3,600 |
| | seconds (which can be changed with the |
| | :ref:`rollover<class_ProjectSettings_property_rendering/limits/time/time_rollover_secs>`|
| | setting). It's not affected by :ref:`time_scale<class_Engine_property_time_scale>` or |
| | pausing. If you need a ``TIME`` variable that can be scaled or paused, add your own |
| | :ref:`global shader uniform<doc_shading_language_global_uniforms>` and update it each |
| | frame. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ration of circle's circumference to its diameter and amount of radians in half turn. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **TAU** | A ``TAU`` constant (``6.283185``). |
| | An equivalent of ``PI * 2`` and amount of radians in full turn. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **E** | An ``E`` constant (``2.718281``). |
| | Euler's number and a base of the natural logarithm. |
+-------------------+-----------------------------------------------------------------------------------------+

Vertex built-ins
^^^^^^^^^^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion tutorials/shaders/shader_reference/fog_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ Global built-ins are available everywhere, including in custom functions.
+---------------------------------+-----------------------------------------------------------------------------------------+
| Built-in | Description |
+=================================+=========================================================================================+
| in float **TIME** | Global time, in seconds. |
| in float **TIME** | Global time since the engine has started, in seconds. It repeats after every 3,600 |
| | seconds (which can be changed with the |
| | :ref:`rollover<class_ProjectSettings_property_rendering/limits/time/time_rollover_secs>`|
| | setting). It's not affected by :ref:`time_scale<class_Engine_property_time_scale>` or |
| | pausing. If you need a ``TIME`` variable that can be scaled or paused, add your own |
| | :ref:`global shader uniform<doc_shading_language_global_uniforms>` and update it each |
| | frame. |
+---------------------------------+-----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ratio of a circle's circumference to its diameter and amount of radians in half turn. |
Expand Down
32 changes: 19 additions & 13 deletions tutorials/shaders/shader_reference/particle_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,25 @@ Global built-ins

Global built-ins are available everywhere, including custom functions.

+-------------------+----------------------------------------------------------------------------------------+
| Built-in | Description |
+===================+========================================================================================+
| in float **TIME** | Global time, in seconds. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ration of circle's circumference to its diameter and amount of radians in half turn. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **TAU** | A ``TAU`` constant (``6.283185``). |
| | An equivalent of ``PI * 2`` and amount of radians in full turn. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **E** | An ``E`` constant (``2.718281``). Euler's number and a base of the natural logarithm. |
+-------------------+----------------------------------------------------------------------------------------+
+-------------------+-----------------------------------------------------------------------------------------+
| Built-in | Description |
+===================+=========================================================================================+
| in float **TIME** | Global time since the engine has started, in seconds. It repeats after every 3,600 |
| | seconds (which can be changed with the |
| | :ref:`rollover<class_ProjectSettings_property_rendering/limits/time/time_rollover_secs>`|
| | setting). It's not affected by :ref:`time_scale<class_Engine_property_time_scale>` or |
| | pausing. If you need a ``TIME`` variable that can be scaled or paused, add your own |
| | :ref:`global shader uniform<doc_shading_language_global_uniforms>` and update it each |
| | frame. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ration of circle's circumference to its diameter and amount of radians in half turn. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **TAU** | A ``TAU`` constant (``6.283185``). |
| | An equivalent of ``PI * 2`` and amount of radians in full turn. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **E** | An ``E`` constant (``2.718281``). Euler's number and a base of the natural logarithm. |
+-------------------+-----------------------------------------------------------------------------------------+

Start and Process built-ins
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions tutorials/shaders/shader_reference/shading_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@ The syntax also supports subgroups (it's not mandatory to declare the base group

group_uniforms MyGroup.MySubgroup;

.. _doc_shading_language_global_uniforms:

Global uniforms
~~~~~~~~~~~~~~~

Expand Down
8 changes: 7 additions & 1 deletion tutorials/shaders/shader_reference/sky_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ There are 4 ``LIGHTX`` lights, accessed as ``LIGHT0``, ``LIGHT1``, ``LIGHT2``, a
+---------------------------------+--------------------------------------------------------------------------------------------------------------------------+
| Built-in | Description |
+=================================+==========================================================================================================================+
| in float **TIME** | Global time, in seconds. |
| in float **TIME** | Global time since the engine has started, in seconds. It repeats after every 3,600 |
| | seconds (which can be changed with the |
| | :ref:`rollover<class_ProjectSettings_property_rendering/limits/time/time_rollover_secs>` |
| | setting). It's not affected by :ref:`time_scale<class_Engine_property_time_scale>` or |
| | pausing. If you need a ``TIME`` variable that can be scaled or paused, add your own |
| | :ref:`global shader uniform<doc_shading_language_global_uniforms>` and update it each |
| | frame. |
+---------------------------------+--------------------------------------------------------------------------------------------------------------------------+
| in vec3 **POSITION** | Camera position in world space |
+---------------------------------+--------------------------------------------------------------------------------------------------------------------------+
Expand Down
32 changes: 19 additions & 13 deletions tutorials/shaders/shader_reference/spatial_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,25 @@ Global built-ins

Global built-ins are available everywhere, including custom functions.

+-------------------+----------------------------------------------------------------------------------------+
| Built-in | Description |
+===================+========================================================================================+
| in float **TIME** | Global time, in seconds. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ration of circle's circumference to its diameter and amount of radians in half turn. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **TAU** | A ``TAU`` constant (``6.283185``). |
| | An equivalent of ``PI * 2`` and amount of radians in full turn. |
+-------------------+----------------------------------------------------------------------------------------+
| in float **E** | An ``E`` constant (``2.718281``). Euler's number and a base of the natural logarithm. |
+-------------------+----------------------------------------------------------------------------------------+
+-------------------+-----------------------------------------------------------------------------------------+
| Built-in | Description |
+===================+=========================================================================================+
| in float **TIME** | Global time since the engine has started, in seconds. It repeats after every 3,600 |
| | seconds (which can be changed with the |
| | :ref:`rollover<class_ProjectSettings_property_rendering/limits/time/time_rollover_secs>`|
| | setting). It's not affected by :ref:`time_scale<class_Engine_property_time_scale>` or |
| | pausing. If you need a ``TIME`` variable that can be scaled or paused, add your own |
| | :ref:`global shader uniform<doc_shading_language_global_uniforms>` and update it each |
| | frame. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **PI** | A ``PI`` constant (``3.141592``). |
| | A ration of circle's circumference to its diameter and amount of radians in half turn. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **TAU** | A ``TAU`` constant (``6.283185``). |
| | An equivalent of ``PI * 2`` and amount of radians in full turn. |
+-------------------+-----------------------------------------------------------------------------------------+
| in float **E** | An ``E`` constant (``2.718281``). Euler's number and a base of the natural logarithm. |
+-------------------+-----------------------------------------------------------------------------------------+

Vertex built-ins
^^^^^^^^^^^^^^^^
Expand Down