Skip to content

Commit

Permalink
Update list of spatial shader render modes for Godot 4.3
Browse files Browse the repository at this point in the history
This also improves the documentation for existing render modes.
  • Loading branch information
Calinou committed Aug 3, 2024
1 parent c3f0ec7 commit 6001307
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
9 changes: 6 additions & 3 deletions tutorials/assets_pipeline/importing_images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,12 @@ displayed correctly:

- In 2D, a :ref:`class_CanvasItemMaterial` will need to be created and
configured to use the **Premul Alpha** blend mode on CanvasItems that use this
texture.
- In 3D, there is no support for premultiplied alpha blend mode yet, so this
option is only suited for 2D.
texture. In :ref:`custom canvas item shaders <doc_canvas_item_shader>`,
``render_mode blend_premul_alpha;`` should be used.
- In 3D, a :ref:`class_BaseMaterial3D` will need to be created and configured
to use the **Premul Alpha** blend mode on materials that use this texture.
In :ref:`custom spatial shaders <doc_spatial_shader>`,
``render_mode blend_premul_alpha;`` should be used.

Process > Normal Map Invert Y
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
38 changes: 23 additions & 15 deletions tutorials/shaders/shader_reference/spatial_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Render modes
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **blend_mul** | Multiplicative blend mode. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **blend_premul_alpha** | Premultiplied alpha blend mode (fully transparent = add, fully opaque = mix). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **depth_draw_opaque** | Only draw depth for opaque geometry (not transparent). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **depth_draw_always** | Always draw depth (opaque and transparent). |
Expand All @@ -32,55 +34,57 @@ Render modes
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **depth_test_disabled** | Disable depth testing. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **sss_mode_skin** | Subsurface Scattering mode for skin. |
| **sss_mode_skin** | Subsurface Scattering mode for skin (optimizes visuals for human skin, e.g. boosted red channel). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **cull_back** | Cull back-faces (default). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **cull_front** | Cull front-faces. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **cull_disabled** | Culling disabled (double sided). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **unshaded** | Result is just albedo. No lighting/shading happens in material. |
| **unshaded** | Result is just albedo. No lighting/shading happens in material, making it faster to render. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **wireframe** | Geometry draws using lines (useful for troubleshooting). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **wireframe** | Geometry draws using lines. |
| **debug_shadow_splits** | Directional shadows are drawn using different colors for each split (useful for troubleshooting). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **diffuse_burley** | Burley (Disney PBS) for diffuse (default). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **diffuse_lambert** | Lambert shading for diffuse. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **diffuse_lambert_wrap** | Lambert wrapping (roughness dependent) for diffuse. |
| **diffuse_lambert_wrap** | Lambert-wrap shading (roughness-dependent) for diffuse. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **diffuse_toon** | Toon shading for diffuse. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **specular_schlick_ggx** | Schlick-GGX for specular (default). |
| **specular_schlick_ggx** | Schlick-GGX for direct light specular lobes (default). |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **specular_toon** | Toon for specular. |
| **specular_toon** | Toon for direct light specular lobes. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **specular_disabled** | Disable specular. |
| **specular_disabled** | Disable direct light specular lobes. Doesn't affect reflected light (use ``SPECULAR = 0.0`` instead).|
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **skip_vertex_transform** | VERTEX/NORMAL/etc. need to be transformed manually in vertex function. |
| **skip_vertex_transform** | ``VERTEX``/``NORMAL``/etc. need to be transformed manually in the ``vertex()`` function. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **world_vertex_coords** | VERTEX/NORMAL/etc. are modified in world coordinates instead of local. |
| **world_vertex_coords** | ``VERTEX``/``NORMAL``/etc. are modified in world coordinates instead of local. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **ensure_correct_normals** | Use when non-uniform scale is applied to mesh. |
| **ensure_correct_normals** | Use when non-uniform scale is applied to mesh *(note: currently unimplemented)*. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **shadows_disabled** | Disable computing shadows in shader. |
| **shadows_disabled** | Disable computing shadows in shader. The shader will not cast shadows, but can still receive them. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **ambient_light_disabled** | Disable contribution from ambient light and radiance map. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **shadow_to_opacity** | Lighting modifies the alpha so shadowed areas are opaque and |
| | non-shadowed areas are transparent. Useful for overlaying shadows onto |
| | a camera feed in AR. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **vertex_lighting** | Use vertex-based lighting. |
| **vertex_lighting** | Use vertex-based lighting *(note: currently unimplemented)*. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **particle_trails** | Enables the trails when used on particles geometry. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **alpha_to_coverage** | Alpha antialiasing mode, see `here <https://github.com/godotengine/godot/pull/40364>`_ for more. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **alpha_to_coverage_and_one** | Alpha antialiasing mode, see `here <https://github.com/godotengine/godot/pull/40364>`_ for more. |
+-------------------------------+------------------------------------------------------------------------------------------------------+
| **fog_disabled** | Disable receiving depth-based or volumetric fog. Useful for blend_add materials like particles. |
| **fog_disabled** | Disable receiving depth-based or volumetric fog. Useful for ``blend_add`` materials like particles. |
+-------------------------------+------------------------------------------------------------------------------------------------------+

Built-ins
Expand Down Expand Up @@ -347,17 +351,21 @@ these properties, and if you don't write to them, Godot will optimize away the c
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out vec2 **ALPHA_TEXTURE_COORDINATE** | |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **PREMUL_ALPHA_FACTOR** | Premultiplied alpha factor. Only effective if ``render_mode blend_premul_alpha;`` is used. |
| | This should be written to when using a *shaded* material with premultiplied alpha blending for |
| | interaction with lighting. This is not required for unshaded materials. |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **METALLIC** | Metallic (0..1). |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **SPECULAR** | Specular. Defaults to 0.5, best not to modify unless you want to change IOR. |
| out float **SPECULAR** | Specular (not physically accurate to change). Defaults to ``0.5``. ``0.0`` disables reflections. |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **ROUGHNESS** | Roughness (0..1). |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **RIM** | Rim (0..1). If used, Godot calculates rim lighting. |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **RIM_TINT** | Rim Tint, goes from 0 (white) to 1 (albedo). If used, Godot calculates rim lighting. |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **CLEARCOAT** | Small added specular blob. If used, Godot calculates Clearcoat. |
| out float **CLEARCOAT** | Small specular blob added on top of the existing one. If used, Godot calculates Clearcoat. |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
| out float **CLEARCOAT_GLOSS** | Gloss of Clearcoat. If used, Godot calculates Clearcoat. |
+----------------------------------------+--------------------------------------------------------------------------------------------------+
Expand Down

0 comments on commit 6001307

Please sign in to comment.