浏览代码

updated shader builtins from recent commits

clayjohn 6 年之前
父节点
当前提交
39c27eb93c

+ 6 - 0
tutorials/shading/shading_reference/canvas_item_shader.rst

@@ -26,6 +26,8 @@ Render modes
 +---------------------------------+----------------------------------------------------------------------+
 | **blend_premul_alpha**          | Pre-multiplied alpha blend mode.                                     |
 +---------------------------------+----------------------------------------------------------------------+
+| **blend_disabled**              | Disable blending, values (including alpha) are written as-is.        |
++---------------------------------+----------------------------------------------------------------------+
 | **unshaded**                    | Result is just albedo. No lighting/shading happens in material.      |
 +---------------------------------+----------------------------------------------------------------------+
 | **light_only**                  | Only draw on light pass.                                             |
@@ -83,6 +85,10 @@ is usually:
 +--------------------------------+----------------------------------------------------------------+
 | inout vec2 **VERTEX**          | Vertex, in image space.                                        |
 +--------------------------------+----------------------------------------------------------------+
+| in vec2 **TEXTURE_PIXEL_SIZE** | Normalized pixel size of default 2D texture.                   |
+|                                | For a Sprite with a texture of size 64x32px,                   |
+|                                | **TEXTURE_PIXEL_SIZE** = :code:`vec2(1/64, 1/32)`              |
++--------------------------------+----------------------------------------------------------------+
 | inout vec2 **UV**              | UV.                                                            |
 +--------------------------------+----------------------------------------------------------------+
 | inout vec4 **COLOR**           | Color from vertex primitive.                                   |

+ 58 - 37
tutorials/shading/shading_reference/spatial_shader.rst

@@ -64,8 +64,14 @@ Render modes
 +---------------------------------+-----------------------------------------------------------------------+
 | **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.                        |
++---------------------------------+-----------------------------------------------------------------------+
 | **vertex_lighting**             | Use vertex-based lighting.                                            |
 +---------------------------------+-----------------------------------------------------------------------+
+| **shadows_disabled**            | Disable computing shaders in shader.                                  |
++---------------------------------+-----------------------------------------------------------------------+
+| **ambient_light_disabled**      | Disable contribution from ambient light and radiance map.             |
++---------------------------------+-----------------------------------------------------------------------+
 
 Vertex built-ins
 ^^^^^^^^^^^^^^^^
@@ -154,6 +160,9 @@ shader, this value can be used as desired.
 +------------------------------------+-------------------------------------------------------+
 | out float **ROUGHNESS**            | Roughness for vertex lighting.                        |
 +------------------------------------+-------------------------------------------------------+
+| in float **OUTPUT_IS_SRGB**        | True when calculations happen in sRGB color space     |
+|                                    | (true in GLES2, false in GLES3).                      |
++------------------------------------+-------------------------------------------------------+
 
 Fragment built-ins
 ^^^^^^^^^^^^^^^^^^
@@ -171,6 +180,8 @@ these properties, and if you don't write to them, Godot will optimize away the c
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
 | in mat4 **INV_CAMERA_MATRIX**     | World space to view space transform.                                                             |
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
+| in mat4 **CAMERA_MATRIX**         | View space to world space transform.                                                             |
++-----------------------------------+--------------------------------------------------------------------------------------------------+
 | in mat4 **PROJECTION_MATRIX**     | View space to clip space transform.                                                              |
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
 | in mat4 **INV_PROJECTION_MATRIX** | Clip space to view space transform.                                                              |
@@ -181,6 +192,8 @@ these properties, and if you don't write to them, Godot will optimize away the c
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
 | in vec3 **VERTEX**                | Vertex that comes from vertex function (default, in view space).                                 |
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
+| in vec3 **VIEW**                  | Vector from camera to fragment position (in view space).                                         |
++-----------------------------------+--------------------------------------------------------------------------------------------------+
 | in bool **FRONT_FACING**          | True if current face is front face.                                                              |
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
 | out vec3 **NORMAL**               | Normal that comes from vertex function (default, in view space).                                 |
@@ -243,6 +256,9 @@ these properties, and if you don't write to them, Godot will optimize away the c
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
 | out float **ALPHA_SCISSOR**       | If written to, values below a certain amount of alpha are discarded.                             |
 +-----------------------------------+--------------------------------------------------------------------------------------------------+
+| in float **OUTPUT_IS_SRGB**       | True when calculations happen in sRGB color space (true in GLES2, false in GLES3).               |
++-----------------------------------+--------------------------------------------------------------------------------------------------+
+
 
 Light built-ins
 ^^^^^^^^^^^^^^^
@@ -258,40 +274,45 @@ means no light is processed.
 The light function is called for every light in every pixel. It is called within a loop for
 each light type. 
 
-+-----------------------------------+------------------------------------------+
-| Built-in                          | Description                              |
-+===================================+==========================================+
-| in vec4 **FRAGCOORD**             | Fragment coordinate, pixel adjusted.     |
-+-----------------------------------+------------------------------------------+
-| in mat4 **WORLD_MATRIX**          | Model space to world space transform.    |
-+-----------------------------------+------------------------------------------+
-| in mat4 **INV_CAMERA_MATRIX**     | World space to view space transform.     |
-+-----------------------------------+------------------------------------------+
-| in mat4 **PROJECTION_MATRIX**     | View space to clip space transform.      |
-+-----------------------------------+------------------------------------------+
-| in mat4 **INV_PROJECTION_MATRIX** | Clip space to view space transform.      |
-+-----------------------------------+------------------------------------------+
-| in float **TIME**                 | Elapsed total time in seconds.           |
-+-----------------------------------+------------------------------------------+
-| in vec2 **VIEWPORT_SIZE**         | Size of viewport (in pixels).            |
-+-----------------------------------+------------------------------------------+
-| in vec3 **NORMAL**                | Normal vector, in view space.            |
-+-----------------------------------+------------------------------------------+
-| in vec3 **VIEW**                  | View vector, in view space.              |
-+-----------------------------------+------------------------------------------+
-| in vec3 **LIGHT**                 | Light Vector, in view space.             |
-+-----------------------------------+------------------------------------------+
-| in vec3 **LIGHT_COLOR**           | Color of light multiplied by energy.     |
-+-----------------------------------+------------------------------------------+
-| in vec3 **ATTENUATION**           | Attenuation based on distance or shadow. |
-+-----------------------------------+------------------------------------------+
-| in vec3 **ALBEDO**                | Base albedo.                             |
-+-----------------------------------+------------------------------------------+
-| in vec3 **TRANSMISSION**          | Transmission mask.                       |
-+-----------------------------------+------------------------------------------+
-| in float **ROUGHNESS**            | Roughness.                               |
-+-----------------------------------+------------------------------------------+
-| out vec3 **DIFFUSE_LIGHT**        | Diffuse light result.                    |
-+-----------------------------------+------------------------------------------+
-| out vec3 **SPECULAR_LIGHT**       | Specular light result.                   |
-+-----------------------------------+------------------------------------------+
++-----------------------------------+---------------------------------------------+
+| Built-in                          | Description                                 |
++===================================+=============================================+
+| in vec4 **FRAGCOORD**             | Fragment coordinate, pixel adjusted.        |
++-----------------------------------+---------------------------------------------+
+| in mat4 **WORLD_MATRIX**          | Model space to world space transform.       |
++-----------------------------------+---------------------------------------------+
+| in mat4 **INV_CAMERA_MATRIX**     | World space to view space transform.        |
++-----------------------------------+---------------------------------------------+
+| in mat4 **CAMERA_MATRIX**         | View space to world space transform.        |
++-----------------------------------+---------------------------------------------+
+| in mat4 **PROJECTION_MATRIX**     | View space to clip space transform.         |
++-----------------------------------+---------------------------------------------+
+| in mat4 **INV_PROJECTION_MATRIX** | Clip space to view space transform.         |
++-----------------------------------+---------------------------------------------+
+| in float **TIME**                 | Elapsed total time in seconds.              |
++-----------------------------------+---------------------------------------------+
+| in vec2 **VIEWPORT_SIZE**         | Size of viewport (in pixels).               |
++-----------------------------------+---------------------------------------------+
+| in vec3 **NORMAL**                | Normal vector, in view space.               |
++-----------------------------------+---------------------------------------------+
+| in vec3 **VIEW**                  | View vector, in view space.                 |
++-----------------------------------+---------------------------------------------+
+| in vec3 **LIGHT**                 | Light Vector, in view space.                |
++-----------------------------------+---------------------------------------------+
+| in vec3 **LIGHT_COLOR**           | Color of light multiplied by energy.        |
++-----------------------------------+---------------------------------------------+
+| in vec3 **ATTENUATION**           | Attenuation based on distance or shadow.    |
++-----------------------------------+---------------------------------------------+
+| in vec3 **ALBEDO**                | Base albedo.                                |
++-----------------------------------+---------------------------------------------+
+| in vec3 **TRANSMISSION**          | Transmission mask.                          |
++-----------------------------------+---------------------------------------------+
+| in float **ROUGHNESS**            | Roughness.                                  |
++-----------------------------------+---------------------------------------------+
+| out vec3 **DIFFUSE_LIGHT**        | Diffuse light result.                       |
++-----------------------------------+---------------------------------------------+
+| out vec3 **SPECULAR_LIGHT**       | Specular light result.                      |
++-----------------------------------+---------------------------------------------+
+| in float **OUTPUT_IS_SRGB**       | True when calculations happen in sRGB       |
+|                                   | color space (true in GLES2, false in GLES3).|
++-----------------------------------+---------------------------------------------+