The post-process effects shader is customizable with four global variables (window object).
Variables | Description | Type |
------------------- | ----------------------------------------- | ------------- |
__POST_SLOT_NAMES__ | The custom slot names scene scoped | Array<string> |
__POST_VERT_BEGIN__ | Insert code at begin of vertex shader | string |
__POST_FRAG_BEGIN__ | Insert code at begin of fragment shader | string |
__POST_VERT_END__ | Insert code at end of vertex shader. | string |
__POST_FRAG_END__ | Insert code at end of fragment shader. | string |
Create a shader.ts file at the same level of your main.ts.
Set variables of your choices and import the script in index.html on top of main.ts.
By this way all these variables are set before the engine start and by extension before the shader program compilation start.
Variables | Scope | Type | Description | BEGIN | END |
------------------------ | ------- | -------------- | --------------------------------------------- | ------------- | -------------- |
fragUV | Var | vec2 | The pixel position. | ||
outputColor | Var | vec4 | Output color | ||
id | Var | vec4 | The pixel id coming from id buffer | ||
flags | Var | integer | The pixel id bitmask (a) | ||
normal | Var | vec3 | The pixel normal coming from normal buffer | ||
depth | Var | float | The pixel depth | ||
shadowFactor | Var | float | The pixel shadow factor (shadow-volume) | ||
shadowDepthCW | Var | float | The pixel depth clock-wise | ||
shadowDepthCCW | Var | float | The pixel depth counter clock-wise | ||
s0 | Var | float | Texel from free texture 0 | ||
s1 | Var | float | Texel from free texture 1 | ||
------------- | ------- | -------------- | --------------------------------------------- | ------------- | -------------- |
PARAMS | Uniform | Params | Global parameters | ||
INFOS | Uniform | Infos | Various infos (screen resolution, time ...) | ||
SOURCE_TEXTURE | Uniform | Texture | Colored source texture (with lit) | ||
NORMALS_TEXTURE | Uniform | Texture | Normals source texture | ||
IDS_TEXTURE | Uniform | Texture | Drawable Indexes source texture | ||
DEPTH_TEXTURE | Uniform | Texture | Depth source texture | ||
SHADOW_FACTOR_TEXTURE | Uniform | Texture | Shadow-volume texture | ||
SHADOW_DEPTH_CCW_TEXTURE | Uniform | Texture | Shadow-volume ccw depth texture | ||
SHADOW_DEPTH_CW_TEXTURE | Uniform | Texture | Shadow-volume cw depth texture | ||
S0_TEXTURE | Uniform | Texture | Free texture 0 | ||
S1_TEXTURE | Uniform | Texture | Free texture 1 |
For numeric there is:
About texture there is: