Browse Source

Update names of shader matrix built-ins in Advanced post-processing (#5713)

nevarek 3 years ago
parent
commit
b11c1b1f70

+ 2 - 2
tutorials/shaders/advanced_postprocessing.rst

@@ -131,7 +131,7 @@ Because the camera is facing the negative ``z`` direction, the position will hav
 In order to get a usable depth value, we have to negate ``view.z``.
 In order to get a usable depth value, we have to negate ``view.z``.
 
 
 The world position can be constructed from the depth buffer using the following code. Note
 The world position can be constructed from the depth buffer using the following code. Note
-that the ``CAMERA_MATRIX`` is needed to transform the position from view space into world space, so
+that the ``INV_VIEW_MATRIX`` is needed to transform the position from view space into world space, so
 it needs to be passed to the fragment shader with a varying.
 it needs to be passed to the fragment shader with a varying.
 
 
 .. code-block:: glsl
 .. code-block:: glsl
@@ -139,7 +139,7 @@ it needs to be passed to the fragment shader with a varying.
   varying mat4 CAMERA;
   varying mat4 CAMERA;
 
 
   void vertex() {
   void vertex() {
-    CAMERA = CAMERA_MATRIX;
+    CAMERA = INV_VIEW_MATRIX;
   }
   }
 
 
   void fragment() {
   void fragment() {

+ 3 - 3
tutorials/shaders/shader_reference/canvas_item_shader.rst

@@ -83,10 +83,10 @@ it manually with the following code:
 
 
     void vertex() {
     void vertex() {
 
 
-        VERTEX = (EXTRA_MATRIX * (WORLD_MATRIX * vec4(VERTEX, 0.0, 1.0))).xy;
+        VERTEX = (EXTRA_MATRIX * (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0))).xy;
     }
     }
 
 
-.. note:: ``WORLD_MATRIX`` is actually a modelview matrix. It takes input in local space and transforms it
+.. note:: ``MODEL_MATRIX`` is known as a modelview matrix. It takes input in local space and transforms it
           into view space.
           into view space.
 
 
 In order to get the world space coordinates of a vertex, you have to pass in a custom uniform like so:
 In order to get the world space coordinates of a vertex, you have to pass in a custom uniform like so:
@@ -121,7 +121,7 @@ is usually:
 +--------------------------------+---------------------------------------------------+
 +--------------------------------+---------------------------------------------------+
 | Built-in                       | Description                                       |
 | Built-in                       | Description                                       |
 +================================+===================================================+
 +================================+===================================================+
-| in mat4 **WORLD_MATRIX**       | Image space to view space transform.              |
+| in mat4 **MODEL_MATRIX**       | Image space to view space transform.              |
 +--------------------------------+---------------------------------------------------+
 +--------------------------------+---------------------------------------------------+
 | in mat4 **CANVAS_MATRIX**      |                                                   |
 | in mat4 **CANVAS_MATRIX**      |                                                   |
 +--------------------------------+---------------------------------------------------+
 +--------------------------------+---------------------------------------------------+

+ 1 - 1
tutorials/shaders/shader_reference/shading_language.rst

@@ -153,7 +153,7 @@ submatrix of the larger matrix is used.
 
 
 .. code-block:: glsl
 .. code-block:: glsl
 
 
-	mat3 basis = mat3(WORLD_MATRIX);
+	mat3 basis = mat3(MODEL_MATRIX);
 	mat4 m4 = mat4(basis);
 	mat4 m4 = mat4(basis);
 	mat2 m2 = mat2(m4);
 	mat2 m2 = mat2(m4);
 
 

+ 6 - 6
tutorials/shaders/shader_reference/spatial_shader.rst

@@ -156,9 +156,9 @@ shader, this value can be used as desired.
 +========================================+========================================================+
 +========================================+========================================================+
 | in vec2 **VIEWPORT_SIZE**              | Size of viewport (in pixels).                          |
 | in vec2 **VIEWPORT_SIZE**              | Size of viewport (in pixels).                          |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
-| in mat4 **INV_CAMERA_MATRIX**          | World space to view space transform.                   |
+| in mat4 **VIEW_MATRIX**                | World space to view space transform.                   |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
-| in mat4 **CAMERA_MATRIX**              | View space to world space transform.                   |
+| in mat4 **INV_VIEW_MATRIX**            | View space to world space transform.                   |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
 | in mat4 **INV_PROJECTION_MATRIX**      | Clip space to view space transform.                    |
 | in mat4 **INV_PROJECTION_MATRIX**      | Clip space to view space transform.                    |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
@@ -199,7 +199,7 @@ shader, this value can be used as desired.
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
 | inout mat3 **MODELVIEW_NORMAL_MATRIX** |                                                        |
 | inout mat3 **MODELVIEW_NORMAL_MATRIX** |                                                        |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
-| inout mat4 **WORLD_MATRIX**            | Model space to world space transform.                  |
+| inout mat4 **MODEL_MATRIX**            | Model space to world space transform.                  |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
 | inout mat3 **WORLD_NORMAL_MATRIX**     |                                                        |
 | inout mat3 **WORLD_NORMAL_MATRIX**     |                                                        |
 +----------------------------------------+--------------------------------------------------------+
 +----------------------------------------+--------------------------------------------------------+
@@ -381,11 +381,11 @@ If you want the lights to add together, add the light contribution to ``DIFFUSE_
 |                                   | specifies fragment depth if ``DEPTH`` is not used. |
 |                                   | specifies fragment depth if ``DEPTH`` is not used. |
 |                                   | Origin is lower-left.                              |
 |                                   | Origin is lower-left.                              |
 +-----------------------------------+----------------------------------------------------+
 +-----------------------------------+----------------------------------------------------+
-| in mat4 **WORLD_MATRIX**          | Model space to world space transform.              |
+| in mat4 **MODEL_MATRIX**          | Model space to world space transform.              |
 +-----------------------------------+----------------------------------------------------+
 +-----------------------------------+----------------------------------------------------+
-| in mat4 **CAMERA_MATRIX**         | View space to world space transform.               |
+| in mat4 **INV_VIEW_MATRIX**       | View space to world space transform.               |
 +-----------------------------------+----------------------------------------------------+
 +-----------------------------------+----------------------------------------------------+
-| in mat4 **INV_CAMERA_MATRIX**     | World space to view space transform.               |
+| in mat4 **VIEW_MATRIX**           | World space to view space transform.               |
 +-----------------------------------+----------------------------------------------------+
 +-----------------------------------+----------------------------------------------------+
 | in mat4 **PROJECTION_MATRIX**     | View space to clip space transform.                |
 | in mat4 **PROJECTION_MATRIX**     | View space to clip space transform.                |
 +-----------------------------------+----------------------------------------------------+
 +-----------------------------------+----------------------------------------------------+