From 0c8c8feb72e8b6ecdab29496f877aa056b871bf0 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Wed, 15 Mar 2023 13:40:46 -0700 Subject: [PATCH] Explain the start and process functions for particle shaders Add references in the particle shader doc and the migration guide --- tutorials/migrating/upgrading_to_godot_4.rst | 14 +++++------ .../shader_reference/particle_shader.rst | 25 ++++++++----------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/tutorials/migrating/upgrading_to_godot_4.rst b/tutorials/migrating/upgrading_to_godot_4.rst index cf906e0ae..d9d741804 100644 --- a/tutorials/migrating/upgrading_to_godot_4.rst +++ b/tutorials/migrating/upgrading_to_godot_4.rst @@ -505,14 +505,12 @@ Godot 3.x, you will have to change its code to call :ref:`class_RenderingServer` methods that affect environment effects' quality. Only the "base" toggle of each environment effect and its visual knobs remain within the Environment resource. -Updating external shaders -^^^^^^^^^^^^^^^^^^^^^^^^^ +Updating shaders +^^^^^^^^^^^^^^^^ -**Only shaders that are built-in to a scene file are modified by the project -upgrade tool.** This means external shaders (saved to ``.gdshader`` files) -need to be updated manually. +There have been some changes to shaders that aren't covered by the upgrade tool. -The ``.shader`` file extension is also no longer supported, which means you must +The ``.shader`` file extension is no longer supported, which means you must rename ``.shader`` files to ``.gdshader`` and update references accordingly in scene/resource files using an external text editor. @@ -521,7 +519,9 @@ Some notable renames you will need to perform in shaders are: - Texture filter and repeat modes are now set on individual uniforms, rather than the texture files themselves. - ``hint_albedo`` is now ``source_color``. -- :ref:`Projection matrix variables were renamed. ` +- :ref:`Built in matrix variables were renamed. ` +- Particles shaders no longer use the ``vertex()`` processor function. Instead + they use ``start()`` and ``process()``. See :ref:`doc_shading_language` for more information. diff --git a/tutorials/shaders/shader_reference/particle_shader.rst b/tutorials/shaders/shader_reference/particle_shader.rst index 6b0b8a767..0e752af9f 100644 --- a/tutorials/shaders/shader_reference/particle_shader.rst +++ b/tutorials/shaders/shader_reference/particle_shader.rst @@ -3,22 +3,19 @@ Particle shaders ================ -Particle shaders are a special type of vertex shader that runs before the -object is drawn. They are used for calculating material properties such as -color, position, and rotation. They are drawn with any regular material for -CanvasItem or Spatial, depending on whether they are 2D or 3D. +Particle shaders are a special type of shader that runs before the object is +drawn. They are used for calculating material properties such as color, +position, and rotation. They are drawn with any regular material for CanvasItem +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 the CanvasItem of Spatial shader. They contain only a vertex processor -function that outputs multiple properties (see built-ins below). +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 the +CanvasItem of Spatial shader. They contain two processor functions: ``start()`` +and ``process()``. -Particle shaders use a transform feedback shader, which is a special type of -vertex shader that runs on its own. It takes in data in a buffer like a regular -vertex shader does, but it also outputs to data buffers instead of outputting -to the fragment shader for pixel-processing. Because of this, transform feedback -shaders can build on themselves each run, unlike other shaders that discard the -data they have calculated once they draw to the frame buffer. +Unlike other shader types, particle shaders keep the data that was output the +previous frame. Therefore, particle shaders ca be used for complex effects that +take place over multiple frames. .. note::