PostProcessor
Implemented by
Index
Methods
optionalgetLayout
Returns VertexLayout
optionalgetShader
Returns Shader
optionalinitialize
Called once when the post processor is added to the graphics context
Parameters
graphicsContext: ExcaliburGraphicsContextWebGL
Returns void
optionalonDraw
Use the onDraw hook to upload any textures or command that need to run right before draw
Returns void
optionalonUpdate
Use the onUpdate hook to update any uniforms in the postprocessors shader
The shader has already been bound so there is no need to call shader.use();
Parameters
elapsed: number
Returns void
optionalprocess
sourceis the current (MSAA-resolved) screen framebuffer, render the result intodestination, for example with a ShaderPass or ShaderPipeline.Parameters
source: Framebuffer
destination: Framebuffer
Returns void
PostProcessors apply a shader effect to the entire screen at the end of the frame.
Implement PostProcessor.process: the current (MSAA-resolved) screen arrives as
sourceand the result must be rendered intodestination— typically with a ShaderPass or ShaderPipeline. Because the shape matches ShaderPipelineLike, effect objects like BloomEffect or BlurEffect can be added as post processors directly:game.graphicsContext.addPostProcessor(new ex.BloomEffect({ graphicsContext }));Use ShaderPipelinePostProcessor to build one from a list of fragment sources.
Fragment shaders in a ShaderPass/ShaderPipeline get these built-ins:
uniform sampler2D u_image- the current screen (or previous pass output)uniform vec2 u_resolution- the destination resolution (in pixels)uniform vec2 u_texelSize-1.0 / source resolutionuniform float u_time_ms- total time in millisecondsuniform float u_elapsed_ms- elapsed milliseconds since the last framein vec2 v_uv- 0-1 UV over the screenThe deprecated single-pass path receives
u_imageat slot 0 plusu_time_ms,u_elapsed_ms, andu_resolutionwhen declared; custom uniforms can be updated in PostProcessor.onUpdate.