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.

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
s0VarfloatTexel from free texture 0
s1VarfloatTexel from free texture 1
----------------------------------------------------------------------------------------------------------
PARAMSUniformParamsGlobal parameters
INFOSUniformInfosVarious infos (screen resolution, time ...)
SOURCE_TEXTUREUniformTextureColored source texture (with lit)
NORMALS_TEXTUREUniformTextureNormals source texture
IDS_TEXTUREUniformTextureDrawable Indexes source texture
DEPTH_TEXTUREUniformTextureDepth source texture
SHADOW_FACTOR_TEXTUREUniformTextureShadow-volume texture
SHADOW_DEPTH_CCW_TEXTUREUniformTextureShadow-volume ccw depth texture
SHADOW_DEPTH_CW_TEXTUREUniformTextureShadow-volume cw depth texture
S0_TEXTUREUniformTextureFree texture 0
S1_TEXTUREUniformTextureFree texture 1

What about new uniforms ?

For numeric there is:

About texture there is:


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