Shader customization

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

VariablesDescriptionType
-------------------------------------------------------------------------
__POST_SLOT_NAMES__The custom slot names scene scopedArray<string>
__POST_VERT_BEGIN__Insert code at begin of vertex shaderstring
__POST_FRAG_BEGIN__Insert code at begin of fragment shaderstring
__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.

Table fragment vars

VariablesScopeTypeDescriptionBEGINEND
---------------------------------------------------------------------------------------------------------------------
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   Edit Freeze Diff History Attach Copy Rename Reload   New Page list Search Recent changes   Help   RSS of recent changes
Last-modified: 2024-07-29 (Mon) 22:26:14