Browse Source

Completed work for 3.0 shader tutorials!

Juan Linietsky 7 years ago
parent
commit
d56ec83090

BIN
img/shader_material_convert.png


BIN
img/shader_material_create.png


BIN
img/shader_material_editor.png


+ 55 - 29
learning/features/shading/screen-reading_shaders.rst

@@ -17,67 +17,74 @@ The workaround is to make a copy of the screen, or a part of the screen,
 to a back-buffer and then read from it while drawing. Godot provides a
 to a back-buffer and then read from it while drawing. Godot provides a
 few tools that makes this process easy!
 few tools that makes this process easy!
 
 
-TexScreen shader instruction
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+SCREEN_TEXTURE built-in texture.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
-Godot :ref:`doc_shading_language` has a special instruction, "texscreen", it takes as
-parameter the UV of the screen and returns a vec3 RGB with the color. A
+Godot :ref:`doc_shading_language` has a special texture, "SCREEN_TEXTURE" (and "DEPTH_TEXTURE" for depth, in case of 3D).
+It takes as parameter the UV of the screen and returns a vec3 RGB with the color. A
 special built-in varying: SCREEN_UV can be used to obtain the UV for
 special built-in varying: SCREEN_UV can be used to obtain the UV for
 the current fragment. As a result, this simple 2D fragment shader:
 the current fragment. As a result, this simple 2D fragment shader:
 
 
 ::
 ::
 
 
-    COLOR=vec4( texscreen(SCREEN_UV), 1.0 );
+    COLOR=textureLod( SCREEN_TEXTURE, SCREEN_UV, 0.0);
 
 
 results in an invisible object, because it just shows what lies behind.
 results in an invisible object, because it just shows what lies behind.
-The same shader using the visual editor looks like this:
 
 
-.. image:: /img/texscreen_visual_shader.png
+The reason why textureLod must be used is because, when Godot copies back
+a chunk of the screen, it also does an efficient separatable gaussian blur to it's mipmaps.
 
 
-TexScreen example
-~~~~~~~~~~~~~~~~~
+This allows for not only reading from the screen, but reading from it with different amounts
+of blur at no cost.
+
+SCREEN_TEXTURE example
+~~~~~~~~~~~~~~~~~~~~~~
 
 
-Texscreen instruction can be used for a lot of things. There is a
+SCREEN_TEXTURE can be used for a lot of things. There is a
 special demo for *Screen Space Shaders*, that you can download to see
 special demo for *Screen Space Shaders*, that you can download to see
 and learn. One example is a simple shader to adjust brightness, contrast
 and learn. One example is a simple shader to adjust brightness, contrast
 and saturation:
 and saturation:
 
 
 ::
 ::
 
 
-    uniform float brightness = 1.0; 
-    uniform float contrast = 1.0;
-    uniform float saturation = 1.0;
+	shader_type canvas_item;
 
 
-    vec3 c = texscreen(SCREEN_UV);
+	uniform float brightness = 1.0; 
+	uniform float contrast = 1.0;
+	uniform float saturation = 1.0;
 
 
-    c.rgb = mix(vec3(0.0), c.rgb, brightness);
-    c.rgb = mix(vec3(0.5), c.rgb, contrast);
-    c.rgb = mix(vec3(dot(vec3(1.0), c.rgb)*0.33333), c.rgb, saturation);
+	vec3 c = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0).rgb;
 
 
-    COLOR.rgb = c;
+	c.rgb = mix(vec3(0.0), c.rgb, brightness);
+	c.rgb = mix(vec3(0.5), c.rgb, contrast);
+	c.rgb = mix(vec3(dot(vec3(1.0), c.rgb)*0.33333), c.rgb, saturation);
+
+	COLOR.rgb = c;
 
 
 Behind the scenes
 Behind the scenes
 ~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~
 
 
-While this seems magical, it's not. The Texscreen instruction, when
+While this seems magical, it's not. The SCREEN_TEXTURE built-in, when
 first found in a node that is about to be drawn, does a full-screen
 first found in a node that is about to be drawn, does a full-screen
-copy to a back-buffer. Subsequent nodes that use texscreen() in
+copy to a back-buffer. Subsequent nodes that use it in
 shaders will not have the screen copied for them, because this ends up
 shaders will not have the screen copied for them, because this ends up
 being very inefficient.
 being very inefficient.
 
 
-As a result, if shaders that use texscreen() overlap, the second one
+As a result, if shaders that use SCREEN_TEXTURE overlap, the second one
 will not use the result of the first one, resulting in unexpected
 will not use the result of the first one, resulting in unexpected
 visuals:
 visuals:
 
 
 .. image:: /img/texscreen_demo1.png
 .. image:: /img/texscreen_demo1.png
 
 
 In the above image, the second sphere (top right) is using the same
 In the above image, the second sphere (top right) is using the same
-source for texscreen() as the first one below, so the first one
+source for SCREEN_TEXTURE as the first one below, so the first one
 "disappears", or is not visible.
 "disappears", or is not visible.
 
 
-To correct this, a
-:ref:`BackBufferCopy <class_BackBufferCopy>`
-node can be instanced between both spheres. BackBufferCopy can work by
+In 3D, this is unavoidable because copying happens when opaque rendering
+completes.
+
+In 2D this can be corrected via the :ref:`BackBufferCopy <class_BackBufferCopy>`
+node, which can be instantiated between both spheres. BackBufferCopy can work by
 either specifying a screen region or the whole screen:
 either specifying a screen region or the whole screen:
 
 
 .. image:: /img/texscreen_bbc.png
 .. image:: /img/texscreen_bbc.png
@@ -92,13 +99,13 @@ Back-buffer logic
 So, to make it clearer, here's how the backbuffer copying logic works in
 So, to make it clearer, here's how the backbuffer copying logic works in
 Godot:
 Godot:
 
 
--  If a node uses the texscreen(), the entire screen is copied to the
+-  If a node uses the SCREEN_TEXTURE, the entire screen is copied to the
    back buffer before drawing that node. This only happens the first
    back buffer before drawing that node. This only happens the first
    time, subsequent nodes do not trigger this.
    time, subsequent nodes do not trigger this.
 -  If a BackBufferCopy node was processed before the situation in the
 -  If a BackBufferCopy node was processed before the situation in the
-   point above (even if texscreen() was not used), this behavior
+   point above (even if SCREEN_TEXTURE was not used), this behavior
    described in the point above does not happen. In other words,
    described in the point above does not happen. In other words,
-   automatic copying of the entire screen only happens if texscreen() is
+   automatic copying of the entire screen only happens if SCREEN_TEXTURE is
    used in a node for the first time and no BackBufferCopy node (not
    used in a node for the first time and no BackBufferCopy node (not
    disabled) was found before in tree-order.
    disabled) was found before in tree-order.
 -  BackBufferCopy can copy either the entire screen or a region. If set
 -  BackBufferCopy can copy either the entire screen or a region. If set
@@ -106,4 +113,23 @@ Godot:
    not in the region copied, the result of that read is undefined
    not in the region copied, the result of that read is undefined
    (most likely garbage from previous frames). In other words, it's
    (most likely garbage from previous frames). In other words, it's
    possible to use BackBufferCopy to copy back a region of the screen
    possible to use BackBufferCopy to copy back a region of the screen
-   and then use texscreen() on a different region. Avoid this behavior!
+   and then use SCREEN_TEXTURE on a different region. Avoid this behavior!
+
+
+DEPTH_TEXTURE
+~~~~~~~~~~~~
+
+For 3D Shaders, it's also possible to access the screen depth buffer. For this,
+the DEPTH_TEXTURE built-in is used. This texture is not linear, it must be
+converted via the inverse projection matrix.
+
+The following code retrieves the 3D position below the pixel being drawn:
+
+::
+
+	float depth = textureLod(DEPTH_TEXTURE,SCREEN_UV,0.0).r;
+	vec4 upos = INV_PROJECTION_MATRIX * vec4(SCREEN_UV*2.0-1.0,depth*2.0-1.0,1.0);
+	vec3 pixel_position = upos.xyz/upos.w;
+
+
+

+ 15 - 24
learning/features/shading/shader_materials.rst

@@ -6,9 +6,13 @@ Shader materials
 Introduction
 Introduction
 ------------
 ------------
 
 
-For the most common cases, :ref:`doc_fixed_materials` are enough to create the
-desired textures or look and feel. Shader materials are a step beyond
-that, adding a huge amount of flexibility. With them, it is possible to:
+For the most common cases, Godot provides ready to use materials for
+most types of shaders, such as SpatialMaterial, CanvasItemMaterial and
+ParticlesMaterial (@TODO link to tutorials/classes). They are flexible implementations that cover most
+use cases. 
+
+Shader materials allow writing a custom shader directly, for maximum flexibility.
+Examples of this are:
 
 
 -  Create procedural textures.
 -  Create procedural textures.
 -  Create complex texture blendings.
 -  Create complex texture blendings.
@@ -16,6 +20,7 @@ that, adding a huge amount of flexibility. With them, it is possible to:
 -  Create refractive effects or other advanced effects.
 -  Create refractive effects or other advanced effects.
 -  Create special lighting shaders for more exotic materials.
 -  Create special lighting shaders for more exotic materials.
 -  Animate vertices, like tree leaves or grass.
 -  Animate vertices, like tree leaves or grass.
+-  Create custom particle code, that responds to baked animations or force fields.
 -  And much more!
 -  And much more!
 
 
 Traditionally, most engines will ask you to learn GLSL, HLSL or CG,
 Traditionally, most engines will ask you to learn GLSL, HLSL or CG,
@@ -28,8 +33,7 @@ Creating a ShaderMaterial
 -------------------------
 -------------------------
 
 
 Create a new ShaderMaterial in some object of your choice. Go to the
 Create a new ShaderMaterial in some object of your choice. Go to the
-"Shader" property, then create a new "MaterialShader" (use
-"MaterialShaderGraph" for access to the visual graph editor):
+"Material" property and create a ShaderMaterial.
 
 
 .. image:: /img/shader_material_create.png
 .. image:: /img/shader_material_create.png
 
 
@@ -37,28 +41,15 @@ Edit the newly created shader, and the shader editor will open:
 
 
 .. image:: /img/shader_material_editor.png
 .. image:: /img/shader_material_editor.png
 
 
-There are three code tabs open, the first is for the vertex shader, the
-second for the fragment and the third for the lighting. The shader
-language is documented in :ref:`doc_shading_language` so a small example will be
-presented next.
-
-Create a very simple fragment shader that writes a color:
-
-::
+Converting to ShaderMaterial
+----------------------------
 
 
-    uniform color col;
-    DIFFUSE = col.rgb;
+It is possible to convert from SpatialMaterial, CanvasItemMaterial and
+ParticlesMaterial to ShaderMaterial. Just go to the material properties
+and enable the convert option.
 
 
-Code changes take place in real-time. If the code is modified, it will
-be instantly recompiled and the object will be updated. If a typo is
-made, the editor will notify of the compilation failure:
+.. image:: /img/shader_material_convert.png
 
 
-.. image:: /img/shader_material_typo.png
 
 
-Finally, go back and edit the material, and the exported uniform will be
-instantly visible:
 
 
-.. image:: /img/shader_material_col.png
 
 
-This allows to very quickly create custom, complex materials for every
-type of object.

+ 100 - 93
learning/features/shading/shading_language.rst

@@ -384,25 +384,30 @@ to make the compiler understand what the uniform is used for.
 
 
 Full list of hints below:
 Full list of hints below:
 
 
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Type              | Hint                          | Description                                                                                                                                                                                                            |
-+===================+===============================+========================================================================================================================================================================================================================+
-| **vec4**          | hint_color                    | This uniform is exported as a color parameter in property editor. Color is also converted from SRGB for 3D shaders.                                                                                                    |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **int**, **float**| hint_range(min,max [,step] )  | This scalar uniform is exported as a given range in property editor.                                                                                                                                                   |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **sampler2D**     | hint_albedo                   | This texture is used as albedo color. Godot will try to make sure the texture has SRGB -> Linear conversion turned on. If no texture is supplied, this is assumed to be white.                                         |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **sampler2D**     | hint_black_albedo             | Same as above but, if no texture is supplied, it's assumed to be black.                                                                                                                                                |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **sampler2D**     | hint_normal                   | The texture supplied is a normal map. Godot will attempt to convert the texture to a more efficient normalmap format when used here. Also, an empty texture results in a vec3(0.0,0.0,1.0) normal assigned by default. |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **sampler2D**     | hint_white                    | Regular texture (non albedo). White is used if unasigned.                                                                                                                                                              |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **sampler2D**     | hint_black                    | Regular texture (non albedo). Black is used if unassigned.                                                                                                                                                             |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| **sampler2D**     | hint_aniso                    | Same as above, but vec3(1.0, 0.5, 0.0) is assigned by default (useful for flowmaps)                                                                                                                                    |
-+-------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
++----------------+-------------------------------+-------------------------------------+
+| 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.       |
++----------------+-------------------------------+-------------------------------------+
+
+
+As Godot 3D engine renders in linear color space, it's important to understand that textures
+that are supplied as color (ie, albedo) need to be specified as such for proper SRGB->linear
+conversion.
 
 
 
 
 Uniforms can also be assigned default values:
 Uniforms can also be assigned default values:
@@ -424,157 +429,159 @@ When vec_type (float), vec_int_type, vec_uint_type, vec_bool_type, nomenclature
 
 
 
 
 
 
+
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
 | Function                                                              | Description                                 |
 | Function                                                              | Description                                 |
 +=======================================================================+=============================================+
 +=======================================================================+=============================================+
-| float *sin* ( float )                                                 | Sine                                        |
+| float **sin** ( float )                                               | Sine                                        |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *cos* ( float )                                                 | Cosine                                      |
+| float **cos** ( float )                                               | Cosine                                      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *tan* ( float )                                                 | Tangent                                     |
+| float **tan** ( float )                                               | Tangent                                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *asin* ( float )                                                | arc-Sine                                    |
+| float **asin** ( float )                                              | arc-Sine                                    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *acos* ( float )                                                | arc-Cosine                                  |
+| float **acos** ( float )                                              | arc-Cosine                                  |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *atan* ( float )                                                | arc-Tangent                                 |
+| float **atan** ( float )                                              | arc-Tangent                                 |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *atan2* ( float x, float y)                                     | arc-Tangent to convert vector to angle      |
+| float **atan2** ( float x, float y)                                   | arc-Tangent to convert vector to angle      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *sinh* ( float )                                                | Hyperbolic-Sine                             |
+| float **sinh** ( float )                                              | Hyperbolic-Sine                             |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *cosh* ( float )                                                | Hyperbolic-Cosine                           |
+| float **cosh** ( float )                                              | Hyperbolic-Cosine                           |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *tanh* ( float )                                                | Hyperbolic-Tangent                          |
+| float **tanh** ( float )                                              | Hyperbolic-Tangent                          |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *pow* ( float x, float y)                                   | Power, x elevated to y                      |
+| vec\_type **pow** ( float x, float y)                                 | Power, x elevated to y                      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *pow* ( vec\_type, vec\_type )                              | Power (Vec. Exponent)                       |
+| vec\_type **pow** ( vec\_type, vec\_type )                            | Power (Vec. Exponent)                       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *exp* ( vec\_type )                                         | Base-e Exponential                          |
+| vec\_type **exp** ( vec\_type )                                       | Base-e Exponential                          |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *log* ( vec\_type )                                         | Natural Logarithm                           |
+| vec\_type **log** ( vec\_type )                                       | Natural Logarithm                           |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *sqrt* ( vec\_type )                                        | Square Root                                 |
+| vec\_type **sqrt** ( vec\_type )                                      | Square Root                                 |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *inversesqrt* ( vec\_type )                                 | Inverse Square Root                         |
+| vec\_type **inversesqrt** ( vec\_type )                               | Inverse Square Root                         |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *abs* ( vec\_type )                                         | Absolute                                    |
+| vec\_type **abs** ( vec\_type )                                       | Absolute                                    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *sign* ( vec\_type )                                        | Sign                                        |
+| vec\_type **sign** ( vec\_type )                                      | Sign                                        |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *floor* ( vec\_type )                                       | Floor                                       |
+| vec\_type **floor** ( vec\_type )                                     | Floor                                       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *round* ( vec\_type )                                       | Round                                       |
+| vec\_type **round** ( vec\_type )                                     | Round                                       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *trunc* ( vec\_type )                                       | Trunc                                       |
+| vec\_type **trunc** ( vec\_type )                                     | Trunc                                       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *ceil* ( vec\_type )                                        | Ceiling                                     |
+| vec\_type **ceil** ( vec\_type )                                      | Ceiling                                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *fract* ( vec\_type )                                       | Fractional                                  |
+| vec\_type **fract** ( vec\_type )                                     | Fractional                                  |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *mod* ( vec\_type,vec\_type )                               | Remainder                                   |
+| vec\_type **mod** ( vec\_type,vec\_type )                             | Remainder                                   |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *modf* ( vec\_type x,out vec\_type i)                       | Fractional of x, with i has integer part    |
+| vec\_type **modf** ( vec\_type x,out vec\_type i)                     | Fractional of x, with i has integer part    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *min* ( vec\_type,vec\_type )                               | Minimum                                     |
+| vec\_type **min** ( vec\_type,vec\_type )                             | Minimum                                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *min* ( vec\_type,vec\_type )                               | Maximum                                     |
+| vec\_type **min** ( vec\_type,vec\_type )                             | Maximum                                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *clamp* ( vec\_type value,vec\_type min, vec\_type max )    | Clamp to Min-Max                            |
+| vec\_type **clamp** ( vec\_type value,vec\_type min, vec\_type max )  | Clamp to Min-Max                            |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *mix* ( vec\_type a,vec\_type b, float c )                  | Linear Interpolate                          |
+| vec\_type **mix** ( vec\_type a,vec\_type b, float c )                | Linear Interpolate                          |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *mix* ( vec\_type a,vec\_type b, vec\_type c )              | Linear Interpolate (Vector Coef.)           |
+| vec\_type **mix** ( vec\_type a,vec\_type b, vec\_type c )            | Linear Interpolate (Vector Coef.)           |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *step* ( vec\_type a,vec\_type b)                           | \` a[i] < b[i] ? 0.0 : 1.0\`                |
+| vec\_type **step** ( vec\_type a,vec\_type b)                         | \` a[i] < b[i] ? 0.0 : 1.0\`                |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *smoothstep* ( vec\_type a,vec\_type b,vec\_type c)         |                                             |
+| vec\_type **smoothstep** ( vec\_type a,vec\_type b,vec\_type c)       |                                             |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_bool_type *isnan* ( vec\_type )                                   | scalar, or vector component being nan       |
+| vec_bool_type **isnan** ( vec\_type )                                 | scalar, or vector component being nan       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_bool_type *isinf* ( vec\_type )                                   | scalar, or vector component being inf       |
+| vec_bool_type **isinf** ( vec\_type )                                 | scalar, or vector component being inf       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_int_type *floatBitsToInt* ( vec_type )                            | Float->Int bit copying, no conversion       |
+| vec_int_type **floatBitsToInt** ( vec_type )                          | Float->Int bit copying, no conversion       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_uint_type *floatBitsToUInt* ( vec_type )                          | Float->UInt bit copying, no conversion      |
+| vec_uint_type **floatBitsToUInt** ( vec_type )                        | Float->UInt bit copying, no conversion      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *intBitsToFloat* ( vec_int_type )                            | Int->Float bit copying, no conversion       |
+| vec_type **intBitsToFloat** ( vec_int_type )                          | Int->Float bit copying, no conversion       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *uintBitsToFloat* ( vec_uint_type )                          | UInt->Float bit copying, no conversion      |
+| vec_type **uintBitsToFloat** ( vec_uint_type )                        | UInt->Float bit copying, no conversion      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *length* ( vec\_type )                                          | Vector Length                               |
+| float **length** ( vec\_type )                                        | Vector Length                               |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *distance* ( vec\_type, vec\_type )                             | Distance between vector.                    |
+| float **distance** ( vec\_type, vec\_type )                           | Distance between vector.                    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *dot* ( vec\_type, vec\_type )                                  | Dot Product                                 |
+| float **dot** ( vec\_type, vec\_type )                                | Dot Product                                 |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec3 *cross* ( vec3, vec3 )                                           | Cross Product                               |
+| vec3 **cross** ( vec3, vec3 )                                         | Cross Product                               |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_type *normalize* ( vec\_type )                                   | Normalize to unit length                    |
+| vec\_type **normalize** ( vec\_type )                                 | Normalize to unit length                    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec3 *reflect* ( vec3, vec3 )                                         | Reflect                                     |
+| vec3 **reflect** ( vec3, vec3 )                                       | Reflect                                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec3 *refract* ( vec3, vec3 )                                         | Refract                                     |
+| vec3 **refract** ( vec3, vec3 )                                       | Refract                                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *faceforward* ( vec_type N, vec_type I, vec_type NRef)       | If dot(Nref, I) < 0 return N, otherwise –N  |
+| vec_type **faceforward** ( vec_type N, vec_type I, vec_type NRef)     | If dot(Nref, I) < 0 return N, otherwise –N  |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| mat_type *matrixCompMult* ( mat_type, mat_type )                      | Matrix Component Multiplication             |
+| mat_type **matrixCompMult** ( mat_type, mat_type )                    | Matrix Component Multiplication             |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| mat_type *outerProduct* ( vec_type, vec_type )                        | Matrix Outer Product                        |
+| mat_type **outerProduct** ( vec_type, vec_type )                      | Matrix Outer Product                        |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| mat_type *transpose* ( mat_type )                                     | Transpose Matrix                            |
+| mat_type **transpose** ( mat_type )                                   | Transpose Matrix                            |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| float *determinant* ( mat_type )                                      | Matrix Determinant                          |
+| float **determinant** ( mat_type )                                    | Matrix Determinant                          |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| mat_type *inverse* ( mat_type )                                       | Inverse Matrix                              |
+| mat_type **inverse** ( mat_type )                                     | Inverse Matrix                              |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_bool_type *lessThan* ( vec_scalar_type )                         | Bool vector cmp on < int/uint/float vectors |
+| vec\_bool_type **lessThan** ( vec_scalar_type )                       | Bool vector cmp on < int/uint/float vectors |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_bool_type *greaterThan* ( vec_scalar_type )                      | Bool vector cmp on > int/uint/float vectors |
+| vec\_bool_type **greaterThan** ( vec_scalar_type )                    | Bool vector cmp on > int/uint/float vectors |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_bool_type *lessThanEqual* ( vec_scalar_type )                    | Bool vector cmp on <=int/uint/float vectors |
+| vec\_bool_type **lessThanEqual** ( vec_scalar_type )                  | Bool vector cmp on <=int/uint/float vectors |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_bool_type *greaterThanEqual* ( vec_scalar_type )                 | Bool vector cmp on >=int/uint/float vectors |
+| vec\_bool_type **greaterThanEqual** ( vec_scalar_type )               | Bool vector cmp on >=int/uint/float vectors |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_bool_type *equal* ( vec_scalar_type )                            | Bool vector cmp on ==int/uint/float vectors |
+| vec\_bool_type **equal** ( vec_scalar_type )                          | Bool vector cmp on ==int/uint/float vectors |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec\_bool_type *notEqual* ( vec_scalar_type )                         | Bool vector cmp on !=int/uint/float vectors |
+| vec\_bool_type **notEqual** ( vec_scalar_type )                       | Bool vector cmp on !=int/uint/float vectors |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| bool *any* ( vec_bool_type )                                          | Any component is true                       |
+| bool **any** ( vec_bool_type )                                        | Any component is true                       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| bool *all* ( vec_bool_type )                                          | All components are true                     |
+| bool **all** ( vec_bool_type )                                        | All components are true                     |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| bool *not* ( vec_bool_type )                                          | No components are true                      |
+| bool **not** ( vec_bool_type )                                        | No components are true                      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| ivec2 *textureSize* ( sampler2D_type s, int lod )                     | Get the size of a texture                   |
+| ivec2 **textureSize** ( sampler2D_type s, int lod )                   | Get the size of a texture                   |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| ivec2 *textureSize* ( samplerCube s, int lod )                        | Get the size of a cubemap                   |
+| ivec2 **textureSize** ( samplerCube s, int lod )                      | Get the size of a cubemap                   |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4_type *texture* ( sampler2D_type s, vec2 uv [, float bias])       | Perform a 2D texture read                   |
+| vec4_type **texture** ( sampler2D_type s, vec2 uv [, float bias])     | Perform a 2D texture read                   |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4 *texture* ( samplerCube s, vec3 uv [, float bias])               | Perform a Cube texture read                 |
+| vec4 **texture** ( samplerCube s, vec3 uv [, float bias])             | Perform a Cube texture read                 |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4_type *textureProj* ( sampler2d_type s, vec3 uv [, float bias])   | Perform a texture read with projection      |
+| vec4_type **textureProj** ( sampler2d_type s, vec3 uv [, float bias]) | Perform a texture read with projection      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4_type *textureProj* ( sampler2d_type s, vec4 uv [, float bias])   | Perform a texture read with projection      |
+| vec4_type **textureProj** ( sampler2d_type s, vec4 uv [, float bias]) | Perform a texture read with projection      |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4_type *textureLod* ( sampler2D_type s, vec2 uv , float lod)       | Perform a 2D texture read at custom mipmap  |
+| vec4_type **textureLod** ( sampler2D_type s, vec2 uv , float lod)     | Perform a 2D texture read at custom mipmap  |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4_type *textureProjLod* ( sampler2d_type s, vec3 uv , float lod)   | Perform a texture read with projection/lod  |
+| vec4_type **textureProjLod** ( sampler2d_type s, vec3 uv , float lod) | Perform a texture read with projection/lod  |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec4_type *textureProjLod* ( sampler2d_type s, vec4 uv , float lod)   | Perform a texture read with projection/lod  |
+| vec4_type **textureProjLod** ( sampler2d_type s, vec4 uv , float lod) | Perform a texture read with projection/lod  |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *texelFetch* ( samplerCube s, ivec2 uv, int lod )            | Fetch a single texel using integer coords   |
+| vec_type **texelFetch** ( samplerCube s, ivec2 uv, int lod )          | Fetch a single texel using integer coords   |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *dFdx* ( vec_type )                                          | Derivative in x using local differencing    |
+| vec_type **dFdx** ( vec_type )                                        | Derivative in x using local differencing    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *dFdy* ( vec_type )                                          | Derivative in y using local differencing    |
+| vec_type **dFdy** ( vec_type )                                        | Derivative in y using local differencing    |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
-| vec_type *fwidth* ( vec_type )                                        | Sum of absolute derivative in x and y       |
+| vec_type **fwidth** ( vec_type )                                      | Sum of absolute derivative in x and y       |
 +-----------------------------------------------------------------------+---------------------------------------------+
 +-----------------------------------------------------------------------+---------------------------------------------+
 
 
 
 
+
 Shader Types In-Depth
 Shader Types In-Depth
 ------------------
 ------------------
 
 
@@ -846,7 +853,7 @@ Light Built-Ins
 +----------------------------------+------------------------------------------+
 +----------------------------------+------------------------------------------+
 | in vec3 **TRANSMISSION**         | Transmission mask.                       |
 | in vec3 **TRANSMISSION**         | Transmission mask.                       |
 +----------------------------------+------------------------------------------+
 +----------------------------------+------------------------------------------+
-| in float **roughness**           | Roughness.                               |
+| in float **ROUGHNESS**           | Roughness.                               |
 +----------------------------------+------------------------------------------+
 +----------------------------------+------------------------------------------+
 | out vec3 **DIFFUSE_LIGHT**       | Diffuse light result.                    |
 | out vec3 **DIFFUSE_LIGHT**       | Diffuse light result.                    |
 +----------------------------------+------------------------------------------+
 +----------------------------------+------------------------------------------+