PostProcess. PostProcessPlugin

Post Process Plugin - Applies a full screen shader to the rendered output

  • Create it after any plugin that draws, since plugins render in the order they are made and this one shades what is on the canvas when its turn comes
  • It runs after gameRenderPost, so a HUD drawn there with WebGL is shaded (and bloomed) too; draw the HUD with useWebGL=false (the main canvas) or from a plugin created after this one

Constructor

new PostProcessPlugin(shaderCodeopt, includeMainCanvasopt, feedbackTextureopt)

Create global post processing shader

Parameters:
NameTypeAttributesDefaultDescription
shaderCodestring<optional>

Shadertoy style mainImage code, a pass-through when left out

includeMainCanvasboolean<optional>
false

combine mainCanvas onto glCanvas

feedbackTextureboolean<optional>
false

also pass the shader's own output from the previous frame as iChannel1, for trails and echoes; iChannel0 is still the frame just drawn

Example
// create the post process plugin object
 new PostProcessPlugin(shaderCode);

Members

feedbackTexture :WebGLTexture|undefined

Type:
  • WebGLTexture | undefined
Properties
TypeDescription
WebGLTexture | undefined

The previous frame's output, iChannel1, when feedbackTexture is set

shader :WebGLProgram|undefined

Type:
  • WebGLProgram | undefined
Properties
TypeDescription
WebGLProgram | undefined

Shader for post processing

texture :WebGLTexture|undefined

Type:
  • WebGLTexture | undefined
Properties
TypeDescription
WebGLTexture | undefined

Texture for post processing

vao :WebGLVertexArrayObject|undefined

Type:
  • WebGLVertexArrayObject | undefined
Properties
TypeDescription
WebGLVertexArrayObject | undefined

Vertex array object