|
@@ -128,7 +128,7 @@ Members
|
|
Individual scalar members of vector types are accessed via the "x", "y", "z" and "w" members. Alternatively, using "r", "g", "b" and "a" also works and is equivalent.
|
|
Individual scalar members of vector types are accessed via the "x", "y", "z" and "w" members. Alternatively, using "r", "g", "b" and "a" also works and is equivalent.
|
|
Use whatever fits best for your use case.
|
|
Use whatever fits best for your use case.
|
|
|
|
|
|
-For matrices, use [idx] indexing syntax to access each vector.
|
|
|
|
|
|
+For matrices, use m[column][row] indexing syntax to access each scalar, or m[idx] for access a vector by column index. For example, for accessing y position of object in mat4 you must use m[3][1] syntax.
|
|
|
|
|
|
Constructing
|
|
Constructing
|
|
~~~~~~~~~~~~
|
|
~~~~~~~~~~~~
|
|
@@ -145,6 +145,14 @@ Construction of vector types must always pass:
|
|
// A single scalar for the whole vector
|
|
// A single scalar for the whole vector
|
|
vec4 a = vec4(0.0);
|
|
vec4 a = vec4(0.0);
|
|
|
|
|
|
|
|
+Construction of matrix types requires pass vectors of same dimension as matrix. You could also build a diagonal matrix using matx(float) syntax. So the mat4(1.0) is an identity matrix.
|
|
|
|
+
|
|
|
|
+.. code-block:: glsl
|
|
|
|
+
|
|
|
|
+ mat2 m2 = mat2(vec2(1.0, 0.0), vec2(0.0, 1.0));
|
|
|
|
+ mat3 m3 = mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0));
|
|
|
|
+ mat4 identity = mat4(1.0);
|
|
|
|
+
|
|
Swizzling
|
|
Swizzling
|
|
~~~~~~~~~
|
|
~~~~~~~~~
|
|
|
|
|
|
@@ -243,7 +251,7 @@ Godot can't protect you from this, so be careful to not make this mistake!
|
|
Discarding
|
|
Discarding
|
|
-----------
|
|
-----------
|
|
|
|
|
|
-Fragment and light functions can use the *discard* keyword. If used, the fragment is discarded and nothing is written.
|
|
|
|
|
|
+Fragment and light functions can use the **discard** keyword. If used, the fragment is discarded and nothing is written.
|
|
|
|
|
|
Functions
|
|
Functions
|
|
---------
|
|
---------
|
|
@@ -462,155 +470,171 @@ A large number of built-in functions are supported, conforming mostly to GLSL ES
|
|
When vec_type (float), vec_int_type, vec_uint_type, vec_bool_type nomenclature is used, it can be scalar or vector.
|
|
When vec_type (float), vec_int_type, vec_uint_type, vec_bool_type nomenclature is used, it can be scalar or vector.
|
|
|
|
|
|
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| Function | Description |
|
|
|
|
-+=======================================================================+=============================================+
|
|
|
|
-| float **sin** ( float ) | Sine |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **cos** ( float ) | Cosine |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **tan** ( float ) | Tangent |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **asin** ( float ) | arc-Sine |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **acos** ( float ) | arc-Cosine |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **atan** ( float ) | arc-Tangent |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **atan2** ( float x, float y) | arc-Tangent to convert vector to angle |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **sinh** ( float ) | Hyperbolic-Sine |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **cosh** ( float ) | Hyperbolic-Cosine |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **tanh** ( float ) | Hyperbolic-Tangent |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **pow** ( float x, float y) | Power, x elevated to y |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **pow** ( vec\_type, vec\_type ) | Power (Vec. Exponent) |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **exp** ( vec\_type ) | Base-e Exponential |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **log** ( vec\_type ) | Natural Logarithm |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **sqrt** ( vec\_type ) | Square Root |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **inversesqrt** ( vec\_type ) | Inverse Square Root |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **abs** ( vec\_type ) | Absolute |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **sign** ( vec\_type ) | Sign |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **floor** ( vec\_type ) | Floor |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **round** ( vec\_type ) | Round |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **trunc** ( vec\_type ) | Trunc |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **ceil** ( vec\_type ) | Ceiling |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **fract** ( vec\_type ) | Fractional |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| 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 **min** ( vec\_type,vec\_type ) | Minimum |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **max** ( vec\_type,vec\_type ) | Maximum |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| 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, 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 **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 **isinf** ( vec\_type ) | scalar, or vector component being inf |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| 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_type **intBitsToFloat** ( vec_int_type ) | Int->Float bit copying, no conversion |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec_type **uintBitsToFloat** ( vec_uint_type ) | UInt->Float bit copying, no conversion |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **length** ( vec\_type ) | Vector Length |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **distance** ( vec\_type, vec\_type ) | Distance between vector. |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **dot** ( vec\_type, vec\_type ) | Dot Product |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec3 **cross** ( vec3, vec3 ) | Cross Product |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec\_type **normalize** ( vec\_type ) | Normalize to unit length |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec3 **reflect** ( vec3, vec3 ) | Reflect |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| 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 |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| mat_type **matrixCompMult** ( mat_type, mat_type ) | Matrix Component Multiplication |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| mat_type **outerProduct** ( vec_type, vec_type ) | Matrix Outer Product |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| mat_type **transpose** ( mat_type ) | Transpose Matrix |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| float **determinant** ( mat_type ) | Matrix Determinant |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| 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 **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 **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 **notEqual** ( vec_scalar_type ) | Bool vector cmp on != int/uint/float vectors|
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| bool **any** ( vec_bool_type ) | Any component is true |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| bool **all** ( vec_bool_type ) | All 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** ( 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** ( 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, 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 **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 |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| 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 **dFdy** ( vec_type ) | Derivative in y using local differencing |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
-| vec_type **fwidth** ( vec_type ) | Sum of absolute derivative in x and y |
|
|
|
|
-+-----------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| Function | Description |
|
|
|
|
++=========================================================================+=============================================+
|
|
|
|
+| vec_type **radians** ( vec_type ) | Convert degrees to radians |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **degrees** ( vec_type ) | Convert radians to degrees |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **sin** ( float ) | Sine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **cos** ( float ) | Cosine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **tan** ( float ) | Tangent |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **asin** ( float ) | arc-Sine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **acos** ( float ) | arc-Cosine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **atan** ( float ) | arc-Tangent |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **asinh** ( float ) | arc-Hyperbolic-Sine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **acosh** ( float ) | arc-Hyperbolic-Cosine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **atanh** ( float ) | arc-Hyperbolic-Tangent |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **atan2** ( float x, float y ) | arc-Tangent to convert vector to angle |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **sinh** ( float ) | Hyperbolic-Sine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **cosh** ( float ) | Hyperbolic-Cosine |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **tanh** ( float ) | Hyperbolic-Tangent |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **pow** ( float x, float y ) | Power, x elevated to y |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **pow** ( vec_type, vec_type ) | Power (Vec. Exponent) |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **exp** ( vec_type ) | Base-e Exponential |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **exp2** ( vec_type ) | Base-2 Exponential |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **log** ( vec_type ) | Natural Logarithm |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **log2** ( vec_type ) | Base-2 Logarithm |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **sqrt** ( vec_type ) | Square Root |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **inversesqrt** ( vec_type ) | Inverse Square Root |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **abs** ( vec_type ) | Absolute |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **sign** ( vec_type ) | Sign |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **floor** ( vec_type ) | Floor |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **round** ( vec_type ) | Round |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **roundEven** ( vec_type ) | Round nearest even |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **trunc** ( vec_type ) | Trunc |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **ceil** ( vec_type ) | Ceiling |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **fract** ( vec_type ) | Fractional |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| 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 **min** ( vec_type, vec_type ) | Minimum |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **max** ( vec_type, vec_type ) | Maximum |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| 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, 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 **smoothstep** ( vec_type a, vec_type b, vec_type c ) | Hermite Interpolate |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| 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_int_type **floatBitsToInt** ( vec_type ) | Float->Int 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 **uintBitsToFloat** ( vec_uint_type ) | UInt->Float bit copying, no conversion |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **length** ( vec_type ) | Vector Length |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **distance** ( vec_type, vec_type ) | Distance between vector |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **dot** ( vec_type, vec_type ) | Dot Product |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec3 **cross** ( vec3, vec3 ) | Cross Product |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **normalize** ( vec_type ) | Normalize to unit length |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec3 **reflect** ( vec3, vec3 ) | Reflect |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| 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 |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| mat_type **matrixCompMult** ( mat_type, mat_type ) | Matrix Component Multiplication |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| mat_type **outerProduct** ( vec_type, vec_type ) | Matrix Outer Product |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| mat_type **transpose** ( mat_type ) | Transpose Matrix |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| float **determinant** ( mat_type ) | Matrix Determinant |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| 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 **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 **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 **notEqual** ( vec_scalar_type ) | Bool vector cmp on != int/uint/float vectors|
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| bool **any** ( vec_bool_type ) | Any component is true |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| bool **all** ( vec_bool_type ) | All 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** ( 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** ( 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, 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 **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 |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| 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 **dFdy** ( vec_type ) | Derivative in y using local differencing |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
+| vec_type **fwidth** ( vec_type ) | Sum of absolute derivative in x and y |
|
|
|
|
++-------------------------------------------------------------------------+---------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -620,7 +644,7 @@ Shader Types In-Depth
|
|
Spatial
|
|
Spatial
|
|
~~~~~~~
|
|
~~~~~~~
|
|
|
|
|
|
-Accepted render modes and built-ins for "shader_type spatial;".
|
|
|
|
|
|
+Accepted render modes and built-ins for **shader_type spatial;**.
|
|
|
|
|
|
Render Modes
|
|
Render Modes
|
|
^^^^^^^^^^^^
|
|
^^^^^^^^^^^^
|
|
@@ -662,7 +686,7 @@ Render Modes
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
| **diffuse_burley** | Burley (Disney PBS) for diffuse. |
|
|
| **diffuse_burley** | Burley (Disney PBS) for diffuse. |
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
-| **diffuse toon** | Toon shading for diffuse. |
|
|
|
|
|
|
+| **diffuse_toon** | Toon shading for diffuse. |
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
| **specular_schlick_ggx** | Schlick-GGX for specular (default). |
|
|
| **specular_schlick_ggx** | Schlick-GGX for specular (default). |
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
@@ -681,52 +705,52 @@ Render Modes
|
|
| **vertex_lighting** | Use vertex-based lighting. |
|
|
| **vertex_lighting** | Use vertex-based lighting. |
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
|
|
|
|
-
|
|
|
|
Vertex Built-Ins
|
|
Vertex Built-Ins
|
|
^^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| Built-In | Object vertex to world space transform. |
|
|
|
|
-+==================================+=======================================================+
|
|
|
|
-| mat4 **WORLD_MATRIX** | Model space to world space transform. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| mat4 **INV_CAMERA_MATRIX** | World space to view space transform. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| mat4 **CAMERA_MATRIX** | View space to world space transform. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| mat4 **MODELVIEW_MATRIX** | Model space to view space transform (use if possible).|
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| mat4 **INV_PROJECTION_MATRIX** | Clip space to view space transform. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| float **TIME** | Elapsed total time in seconds. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec2 **VIEWPORT_SIZE** | Size of viewport (in pixels). |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec3 **VERTEX** | Vertex in local coords (see doc below). |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec3 **NORMAL** | Normal in local coords. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec3 **TANGENT** | Tangent in local coords. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec3 **BINORMAL** | Binormal in local coords. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec2 **UV** | UV main channel. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec2 **UV2** | UV secondary channel. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec4 **COLOR** | Color from vertices. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec2 **POINT_SIZE** | Point size for point rendering. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| int **INSTANCE_ID** | Instance ID for instancing. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| vec4 **INSTANCE_CUSTOM** | Instance custom data (for particles, mostly). |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-| float **ROUGHNESS** | Roughness for vertex lighting. |
|
|
|
|
-+----------------------------------+-------------------------------------------------------+
|
|
|
|
-
|
|
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| Built-In | Description |
|
|
|
|
++====================================+=======================================================+
|
|
|
|
+| out mat4 **WORLD_MATRIX** | Model space to world space transform. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| in mat4 **INV_CAMERA_MATRIX** | World space to view space transform. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| in mat4 **CAMERA_MATRIX** | View space to world space transform. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out mat4 **MODELVIEW_MATRIX** | Model space to view space transform (use if possible).|
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out 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). |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec3 **VERTEX** | Vertex in local coords (see doc below). |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec3 **NORMAL** | Normal in local coords. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec3 **TANGENT** | Tangent in local coords. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec3 **BINORMAL** | Binormal in local coords. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec2 **UV** | UV main channel. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec2 **UV2** | UV secondary channel. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out vec4 **COLOR** | Color from vertices. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out float **POINT_SIZE** | Point size for point rendering. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| in int **INSTANCE_ID** | Instance ID for instancing. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| in vec4 **INSTANCE_CUSTOM** | Instance custom data (for particles, mostly). |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+| out float **ROUGHNESS** | Roughness for vertex lighting. |
|
|
|
|
++------------------------------------+-------------------------------------------------------+
|
|
|
|
+
|
|
|
|
+Values marked as "in" are read-only. Values marked as "out" are for optional writing.
|
|
|
|
|
|
Vertex data (VERTEX, NORMAL, TANGENT, BITANGENT) is presented in local model space. If not
|
|
Vertex data (VERTEX, NORMAL, TANGENT, BITANGENT) is presented in local model space. If not
|
|
written to, these values will not be modified and be passed through as they came.
|
|
written to, these values will not be modified and be passed through as they came.
|
|
@@ -775,25 +799,23 @@ Fragment Built-Ins
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| in mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
|
|
| in mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| in mat4 **CAMERA_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. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| float **TIME** | Elapsed total time in seconds. |
|
|
|
|
|
|
+| in float **TIME** | Elapsed total time in seconds. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| vec2 **VIEWPORT_SIZE** | Size of viewport (in pixels). |
|
|
|
|
|
|
+| in vec2 **VIEWPORT_SIZE** | Size of viewport (in pixels). |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| vec3 **VERTEX** | Vertex that comes from vertex function, in view space. |
|
|
|
|
|
|
+| in vec3 **VERTEX** | Vertex that comes from vertex function, in view space. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| in vec4 **FRAGCOORD** | Fragment cordinate, pixel adjusted. |
|
|
| in vec4 **FRAGCOORD** | Fragment cordinate, pixel adjusted. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| in bool **FRONT_FACING** | true whether current face is front face. |
|
|
| in bool **FRONT_FACING** | true whether current face is front face. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| inout vec3 **NORMAL** | Normal that comes from vertex function, in view space. |
|
|
|
|
|
|
+| out vec3 **NORMAL** | Normal that comes from vertex function, in view space. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| inout vec3 **TANGENT** | Tangent that comes from vertex function. |
|
|
|
|
|
|
+| out vec3 **TANGENT** | Tangent that comes from vertex function. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| inout vec3 **BINORMAL** | Binormal that comes from vertex function. |
|
|
|
|
|
|
+| out vec3 **BINORMAL** | Binormal that comes from vertex function. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| out vec3 **NORMALMAP** | Output this if reading normal from a texture instead of NORMAL. |
|
|
| out vec3 **NORMALMAP** | Output this if reading normal from a texture instead of NORMAL. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
@@ -825,34 +847,29 @@ Fragment Built-Ins
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| out float **ANISOTROPY** | For distorting the specular blob according to tangent space. |
|
|
| out float **ANISOTROPY** | For distorting the specular blob according to tangent space. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| out float **ANISOTROPY_FLOW** | Distortion direction, use with flowmaps. |
|
|
|
|
|
|
+| out vec2 **ANISOTROPY_FLOW** | Distortion direction, use with flowmaps. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| out float **SSS_STRENGTH** | Strength of Subsurface Scattering (default 0). |
|
|
| out float **SSS_STRENGTH** | Strength of Subsurface Scattering (default 0). |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| out vec3 **TRANSMISSION** | Transmission mask (default 0,0,0). |
|
|
| out vec3 **TRANSMISSION** | Transmission mask (default 0,0,0). |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| out foat **AO** | Ambient Occlusion (pre-baked). |
|
|
|
|
|
|
+| out float **AO** | Ambient Occlusion (pre-baked). |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| out float **AO_LIGHT_AFFECT** | How much AO affects lights (0..1. default 0, none). |
|
|
| out float **AO_LIGHT_AFFECT** | How much AO affects lights (0..1. default 0, none). |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| out vec3 **EMISSION** | Emission color (can go over 1,1,1 for HDR). |
|
|
| out vec3 **EMISSION** | Emission color (can go over 1,1,1 for HDR). |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| in sampler2D **SCREEN_TEXTURE** | Built-in Texture for reading from the screen. Mipmaps contain increasingly blurred copies. |
|
|
|
|
|
|
+| out sampler2D **SCREEN_TEXTURE** | Built-in Texture for reading from the screen. Mipmaps contain increasingly blurred copies. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| in sampler2D **DEPTH_TEXTURE** | Built-in Texture for reading depth from the screen. Must convert to linear using INV_PROJECTION. |
|
|
|
|
|
|
+| out sampler2D **DEPTH_TEXTURE** | Built-in Texture for reading depth from the screen. Must convert to linear using INV_PROJECTION. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| in vec2 **SCREEN_UV** | Screen UV coordinate for current pixel. |
|
|
|
|
|
|
+| out vec2 **SCREEN_UV** | Screen UV coordinate for current pixel. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
| in vec2 **POINT_COORD** | Point Coord for drawing points with POINT_SIZE. |
|
|
| in vec2 **POINT_COORD** | Point Coord for drawing points with POINT_SIZE. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
-| in float **SIDE** | SIDE multiplier, for double sided materials. |
|
|
|
|
-+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
|
|
| out float **ALPHA_SCISSOR** | If written to, values below a certain amount of alpha are discarded. |
|
|
| out float **ALPHA_SCISSOR** | If written to, values below a certain amount of alpha are discarded. |
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
+----------------------------------+--------------------------------------------------------------------------------------------------+
|
|
|
|
|
|
-
|
|
|
|
-Values marked as "in" are read-only. Values marked as "out" are for optional writing. If nothing is written, a default value is used.
|
|
|
|
-
|
|
|
|
Light Built-Ins
|
|
Light Built-Ins
|
|
^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
@@ -865,8 +882,6 @@ Light Built-Ins
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
| in mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
|
|
| in mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
-| in mat4 **CAMERA_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. |
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
| in float **TIME** | Elapsed total time in seconds. |
|
|
| in float **TIME** | Elapsed total time in seconds. |
|
|
@@ -877,7 +892,7 @@ Light Built-Ins
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
| in vec3 **VIEW** | View vector. |
|
|
| in vec3 **VIEW** | View vector. |
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
-| in vec3 **LIGHT** | Light Vector. |
|
|
|
|
|
|
+| in vec3 **LIGHT** | Light Vector. |
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
| in vec3 **LIGHT_COLOR** | Color of light multiplied by energy. |
|
|
| in vec3 **LIGHT_COLOR** | Color of light multiplied by energy. |
|
|
+-----------------------------------+------------------------------------------+
|
|
+-----------------------------------+------------------------------------------+
|
|
@@ -904,7 +919,7 @@ Assigning nothing means no light is processed.
|
|
Canvas Item
|
|
Canvas Item
|
|
~~~~~~~~~~~~
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
-Accepted render modes and built-ins for "shader_type canvas_item;".
|
|
|
|
|
|
+Accepted render modes and built-ins for **shader_type canvas_item;**.
|
|
|
|
|
|
Render Modes
|
|
Render Modes
|
|
^^^^^^^^^^^^
|
|
^^^^^^^^^^^^
|
|
@@ -947,13 +962,13 @@ Vertex Built-Ins
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
| in bool **AT_LIGHT_PASS** | True if this is a light pass (for multi-pass light rendering). |
|
|
| in bool **AT_LIGHT_PASS** | True if this is a light pass (for multi-pass light rendering). |
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
-| inout vec2 **VERTEX** | Vertex in image space. |
|
|
|
|
|
|
+| out vec2 **VERTEX** | Vertex in image space. |
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
-| inout vec2 **UV** | UV. |
|
|
|
|
|
|
+| out vec2 **UV** | UV. |
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
-| inout vec4 **COLOR** | Color from vertex primitive. |
|
|
|
|
|
|
+| out vec4 **COLOR** | Color from vertex primitive. |
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
-| out vec2 **POINT_SIZE** | Point size for point drawing. |
|
|
|
|
|
|
+| out float **POINT_SIZE** | Point size for point drawing. |
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
+--------------------------------+----------------------------------------------------------------+
|
|
|
|
|
|
|
|
|
|
@@ -989,37 +1004,39 @@ shader, this value can be used as desired.
|
|
Fragment Built-Ins
|
|
Fragment Built-Ins
|
|
^^^^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| Built-In | Description |
|
|
|
|
-+==================================+============================================================+
|
|
|
|
-| in vec4 **FRAGCOORD** | Fragment coordinate, pixel adjusted. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| out vec3 **NORMAL** | Normal, writable. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| out vec3 **NORMALMAP** | Normal from texture, default is read from NORMAL_TEXTURE. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| out float **NORMALMAP_DEPTH** | Normalmap depth for scaling. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in vec2 **UV** | UV from vertex function. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in vec4 **COLOR** | Color from vertex function. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in sampler2D **TEXTURE** | Default 2D texture. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in sampler2D **NORMAL_TEXTURE** | Default 2D normal texture. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in vec2 **TEXTURE_PIXEL_SIZE** | Default 2D texture pixel size. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in vec2 **SCREEN_UV** | Screen UV for use with SCREEN_TEXTURE. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in vec2 **SCREEN_PIXEL_SIZE** | Screen pixel size. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in vec2 **POINT_COORD** | Coordinate for drawing points. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in float **TIME** | Global time in seconds. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
-| in sampler2D **SCREEN_TEXTURE** | Screen texture, mipmaps contain gaussian blurred versions. |
|
|
|
|
-+----------------------------------+------------------------------------------------------------+
|
|
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| Built-In | Description |
|
|
|
|
++==================================+================================================================+
|
|
|
|
+| in vec4 **FRAGCOORD** | Fragment coordinate, pixel adjusted. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| out vec3 **NORMAL** | Normal, writable. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| out vec3 **NORMALMAP** | Normal from texture, default is read from NORMAL_TEXTURE. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| out float **NORMALMAP_DEPTH** | Normalmap depth for scaling. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in vec2 **UV** | UV from vertex function. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| out vec4 **COLOR** | Color from vertex function. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in sampler2D **TEXTURE** | Default 2D texture. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in sampler2D **NORMAL_TEXTURE** | Default 2D normal texture. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in vec2 **TEXTURE_PIXEL_SIZE** | Default 2D texture pixel size. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in vec2 **SCREEN_UV** | Screen UV for use with SCREEN_TEXTURE. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in vec2 **SCREEN_PIXEL_SIZE** | Screen pixel size. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in vec2 **POINT_COORD** | Coordinate for drawing points. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in float **TIME** | Global time in seconds. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in bool **AT_LIGHT_PASS** | True if this is a light pass (for multi-pass light rendering). |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
+| in sampler2D **SCREEN_TEXTURE** | Screen texture, mipmaps contain gaussian blurred versions. |
|
|
|
|
++----------------------------------+----------------------------------------------------------------+
|
|
|
|
|
|
Light Built-Ins
|
|
Light Built-Ins
|
|
^^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^^
|
|
@@ -1027,7 +1044,7 @@ Light Built-Ins
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
| Built-In | Description |
|
|
| Built-In | Description |
|
|
+=====================================+===============================================================================+
|
|
+=====================================+===============================================================================+
|
|
-| in vec4 **POSITION** | Screen Position. |
|
|
|
|
|
|
+| in vec2 **POSITION** | Screen Position. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
| in vec3 **NORMAL** | Input Normal. |
|
|
| in vec3 **NORMAL** | Input Normal. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
@@ -1045,17 +1062,17 @@ Light Built-Ins
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
| in float **TIME** | Time (in seconds). |
|
|
| in float **TIME** | Time (in seconds). |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
-| vec2 **LIGHT\_VEC** | Vector from light to fragment, can be modified to alter shadow computation. |
|
|
|
|
|
|
+| out vec2 **LIGHT_VEC** | Vector from light to fragment, can be modified to alter shadow computation. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
-| in float **LIGHT\_HEIGHT** | Height of Light. |
|
|
|
|
|
|
+| out float **LIGHT_HEIGHT** | Height of Light. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
-| in color **LIGHT\_COLOR** | Color of Light. |
|
|
|
|
|
|
+| out vec4 **LIGHT_COLOR** | Color of Light. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
-| in color **LIGHT\_SHADOW\_COLOR** | Color of Light shadow. |
|
|
|
|
|
|
+| out vec4 **LIGHT_SHADOW** | Color of Light shadow. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
-| in vec2 **LIGHT\_UV** | UV for light image. |
|
|
|
|
|
|
+| out vec2 **LIGHT_UV** | UV for light image. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
-| in vec4 **SHADOW** | Light shadow color override. |
|
|
|
|
|
|
+| out vec4 **SHADOW** | Light shadow color override. |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
| out vec4 **LIGHT** | Light Output (shader is ignored if this is not used). |
|
|
| out vec4 **LIGHT** | Light Output (shader is ignored if this is not used). |
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
+-------------------------------------+-------------------------------------------------------------------------------+
|
|
@@ -1064,7 +1081,7 @@ Light Built-Ins
|
|
Particles
|
|
Particles
|
|
~~~~~~~~~
|
|
~~~~~~~~~
|
|
|
|
|
|
-Accepted render modes and built-ins for "shader_type particles;".
|
|
|
|
|
|
+Accepted render modes and built-ins for **shader_type particles;**.
|
|
|
|
|
|
Render Modes
|
|
Render Modes
|
|
^^^^^^^^^^^^
|
|
^^^^^^^^^^^^
|
|
@@ -1076,6 +1093,10 @@ Render Modes
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
| **keep_data** | Do not clear previous data on restart. |
|
|
| **keep_data** | Do not clear previous data on restart. |
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
+---------------------------------+----------------------------------------------------------------------+
|
|
|
|
+| **disable_force** | Disable force. |
|
|
|
|
++---------------------------------+----------------------------------------------------------------------+
|
|
|
|
+| **disable_velocity** | Disable velocity. |
|
|
|
|
++---------------------------------+----------------------------------------------------------------------+
|
|
|
|
|
|
Vertex Built-Ins
|
|
Vertex Built-Ins
|
|
^^^^^^^^^^^^^^^^
|
|
^^^^^^^^^^^^^^^^
|
|
@@ -1083,22 +1104,24 @@ Vertex Built-Ins
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
| Built-In | Description |
|
|
| Built-In | Description |
|
|
+=================================+===========================================================+
|
|
+=================================+===========================================================+
|
|
-| inout vec4 **COLOR** | Particle color, can be written to. |
|
|
|
|
|
|
+| out vec4 **COLOR** | Particle color, can be written to. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
-| inout vec3 **VELOCITY** | Particle velocity, can be modified. |
|
|
|
|
|
|
+| out vec3 **VELOCITY** | Particle velocity, can be modified. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
| out float **MASS** | Particle mass, use for attractors (default 1). |
|
|
| out float **MASS** | Particle mass, use for attractors (default 1). |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
-| inout bool **ACTIVE** | Particle is active, can be set to false. |
|
|
|
|
|
|
+| out bool **ACTIVE** | Particle is active, can be set to false. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
| in bool **RESTART** | Set to true when particle must restart (lifetime cycled). |
|
|
| in bool **RESTART** | Set to true when particle must restart (lifetime cycled). |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
-| inout vec4 **CUSTOM** | Custom particle data. |
|
|
|
|
|
|
+| out vec4 **CUSTOM** | Custom particle data. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
-| inout mat4 **TRANSFORM** | Particle transform. |
|
|
|
|
|
|
+| out mat4 **TRANSFORM** | Particle transform. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
| in float **TIME** | Global time in seconds. |
|
|
| in float **TIME** | Global time in seconds. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
|
|
+| in float **LIFETIME** | Particle lifetime. |
|
|
|
|
++---------------------------------+-----------------------------------------------------------+
|
|
| in float **DELTA** | Delta process time. |
|
|
| in float **DELTA** | Delta process time. |
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
+---------------------------------+-----------------------------------------------------------+
|
|
| in uint **NUMBER** | Unique number since emission start. |
|
|
| in uint **NUMBER** | Unique number since emission start. |
|