Browse Source

Merge pull request #1037 from antoniotorresm/master

Add Interpolation qualifiers info to Shading Language reference
Rémi Verschelde 7 years ago
parent
commit
3ef045a2a7
1 changed files with 33 additions and 0 deletions
  1. 33 0
      tutorials/shading/shading_language.rst

+ 33 - 0
tutorials/shading/shading_language.rst

@@ -357,6 +357,39 @@ pixel in the fragment processor.
         ALBEDO = some_color;
     }
 
+Interpolation qualifiers
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Certain values are interpolated during the shading pipeline. You can modify how these interpolations
+are done by using *interpolation qualifiers*. 
+
+.. code-block:: glsl
+
+    shader_type spatial;
+
+    varying flat vec3 our_color;
+    
+    void vertex() {
+        our_color = COLOR.rgb;
+    }
+
+    void fragment() {
+        ALBEDO = our_color;
+    }
+
+There are three possible interpolation qualifiers:
+
++-------------------+---------------------------------------------------------------------------------+
+| Qualifier         | Description                                                                     | 
++===================+=================================================================================+
+| **flat**          | The value is not interpolated                                                   |
++-------------------+---------------------------------------------------------------------------------+
+| **noperspective** | The value is linearly interpolated in window-space                              |
++-------------------+---------------------------------------------------------------------------------+
+| **smooth**        | The value is interpolated in a perspective-correct fashion. This is the default |
++-------------------+---------------------------------------------------------------------------------+
+
+
 Uniforms
 ~~~~~~~~