From 4e97b589b0c3145f080404b2b8dd2e652b7e9289 Mon Sep 17 00:00:00 2001 From: alex-pahdo <109116583+alex-pahdo@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:20:23 -0700 Subject: [PATCH] Clarify `hint_range` in Shading language (#6029) --- .../shader_reference/shading_language.rst | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tutorials/shaders/shader_reference/shading_language.rst b/tutorials/shaders/shader_reference/shading_language.rst index a17b85ad1..36d70c228 100644 --- a/tutorials/shaders/shader_reference/shading_language.rst +++ b/tutorials/shaders/shader_reference/shading_language.rst @@ -550,8 +550,9 @@ You can set uniforms in the editor in the material. Or you can set them through .. note:: The first argument to ``set_shader_param`` is the name of the uniform in the shader. It must match *exactly* to the name of the uniform in the shader or else it will not be recognized. -Any GLSL type except for *void* can be a uniform. Additionally, Godot provides optional shader hints -to make the compiler understand for what the uniform is used. +Any GLSL type except for *void* can be a uniform. Additionally, Godot provides +optional shader hints to make the compiler understand for what the uniform is +used, and how the editor should allow users to modify it. .. code-block:: glsl @@ -565,25 +566,25 @@ It's important to understand that textures that are supplied as color require hi Full list of hints below: -+----------------+------------------------------+-------------------------------------+ -| Type | Hint | Description | -+================+==============================+=====================================+ -| **vec4** | hint_color | Used as color | -+----------------+------------------------------+-------------------------------------+ -| **int, float** | hint_range(min, max[, step]) | Used as range (with min/max/step) | -+----------------+------------------------------+-------------------------------------+ -| **sampler2D** | hint_albedo | Used as albedo color, default white | -+----------------+------------------------------+-------------------------------------+ -| **sampler2D** | hint_black_albedo | Used as albedo color, default black | -+----------------+------------------------------+-------------------------------------+ -| **sampler2D** | hint_normal | Used as normalmap | -+----------------+------------------------------+-------------------------------------+ -| **sampler2D** | hint_white | As value, default to white. | -+----------------+------------------------------+-------------------------------------+ -| **sampler2D** | hint_black | As value, default to black | -+----------------+------------------------------+-------------------------------------+ -| **sampler2D** | hint_aniso | As flowmap, default to right. | -+----------------+------------------------------+-------------------------------------+ ++----------------+------------------------------+------------------------------------------------------+ +| Type | Hint | Description | ++================+==============================+======================================================+ +| **vec4** | hint_color | Used as color. | ++----------------+------------------------------+------------------------------------------------------+ +| **int, float** | hint_range(min, max[, step]) | Restricted to values in a range (with min/max/step). | ++----------------+------------------------------+------------------------------------------------------+ +| **sampler2D** | hint_albedo | Used as albedo color, default white. | ++----------------+------------------------------+------------------------------------------------------+ +| **sampler2D** | hint_black_albedo | Used as albedo color, default black. | ++----------------+------------------------------+------------------------------------------------------+ +| **sampler2D** | hint_normal | Used as normalmap. | ++----------------+------------------------------+------------------------------------------------------+ +| **sampler2D** | hint_white | As value, default to white. | ++----------------+------------------------------+------------------------------------------------------+ +| **sampler2D** | hint_black | As value, default to black | ++----------------+------------------------------+------------------------------------------------------+ +| **sampler2D** | hint_aniso | As flowmap, default to right. | ++----------------+------------------------------+------------------------------------------------------+ GDScript uses different variable types than GLSL does, so when passing variables from GDScript to shaders, Godot converts the type automatically. Below is a table of the corresponding types: