The post-process effects shader is customizable with four global variables (window object).
Variables | Description |
--------------- | ----------------------------------------- |
PPE_VERT_BEFORE | Insert code before vertex computation |
PPE_FRAG_BEFORE | Insert code before fragment computation |
PPE_VERT_AFTER | Insert code after vertex computation |
PPE_FRAG_AFTER | Insert code after fragment computation |
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.
A set of built-in uniforms are reserved for customization.
For now there is 16 floats available in Gfx3PPERenderer params.
Variables | Scope | Type | Description | In before | In after |
------------------------ | ------- | -------------- | --------------------------------------------- | ------------- | -------------- |
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 | ||
------------- | ------- | -------------- | --------------------------------------------- | ------------- | -------------- |
PARAMS | Uniform | Params | Global parameters | ||
INFOS | Uniform | Infos | The ppe infos (resolution, time) | ||
SOURCE_TEXTURE | Uniform | Texture | The colored source texture (with lit) | ||
NORMALS_TEXTURE | Uniform | Texture | The normals source texture | ||
IDS_TEXTURE | Uniform | Texture | The indexes source texture | ||
DEPTH_TEXTURE | Uniform | Texture | The depth source texture | ||
SHADOW_FACTOR_TEXTURE | Uniform | Texture | The shadow-volume texture | ||
SHADOW_DEPTH_CCW_TEXTURE | Uniform | Texture | The shadow-volume ccw depth texture | ||
SHADOW_DEPTH_CW_TEXTURE | Uniform | Texture | The shadow-volume cw depth texture |