Shader customization

The post-process effects shader is customizable with four global variables (window object).

VariablesDescription
--------------------------------------------------------
PPE_VERT_BEFOREInsert code before vertex computation
PPE_FRAG_BEFOREInsert code before fragment computation
PPE_VERT_AFTERInsert code after vertex computation
PPE_FRAG_AFTERInsert 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.

What about uniforms ?

A set of built-in uniforms are reserved for customization.
For now there is 16 floats available in Gfx3PPERenderer params.

Table fragment vars

VariablesScopeTypeDescriptionIn beforeIn after
---------------------------------------------------------------------------------------------------------------------
fragUVVarvec2The pixel position.
outputColorVarvec4Output color
idVarvec4The pixel id coming from id buffer
flagsVarintegerThe pixel id bitmask (a)
normalVarvec3The pixel normal coming from normal buffer
depthVarfloatThe pixel depth
shadowFactorVarfloatThe pixel shadow factor (shadow-volume)
shadowDepthCWVarfloatThe pixel depth clock-wise
shadowDepthCCWVarfloatThe pixel depth counter clock-wise
----------------------------------------------------------------------------------------------------------
PARAMSUniformParamsGlobal parameters
INFOSUniformInfosThe ppe infos (resolution, time)
SOURCE_TEXTUREUniformTextureThe colored source texture (with lit)
NORMALS_TEXTUREUniformTextureThe normals source texture
IDS_TEXTUREUniformTextureThe indexes source texture
DEPTH_TEXTUREUniformTextureThe depth source texture
SHADOW_FACTOR_TEXTUREUniformTextureThe shadow-volume texture
SHADOW_DEPTH_CCW_TEXTUREUniformTextureThe shadow-volume ccw depth texture
SHADOW_DEPTH_CW_TEXTUREUniformTextureThe shadow-volume cw depth texture

Front page   New Page list Search Recent changes   Help   RSS of recent changes