Skip to main content

ColorBlindnessPostProcessor

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 source and the result must be rendered into destination — 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 resolution
  • uniform float u_time_ms - total time in milliseconds
  • uniform float u_elapsed_ms - elapsed milliseconds since the last frame
  • in vec2 v_uv - 0-1 UV over the screen

The deprecated single-pass path receives u_image at slot 0 plus u_time_ms, u_elapsed_ms, and u_resolution when declared; custom uniforms can be updated in PostProcessor.onUpdate.

Implements

Index

Constructors

constructor

Accessors

colorBlindnessMode

simulate

  • get simulate(): boolean
  • set simulate(value: boolean): void
  • Returns boolean

  • Parameters

    • value: boolean

    Returns void

Methods

initialize

  • Called once when the post processor is added to the graphics context


    Parameters

    Returns void

process

  • source is the current (MSAA-resolved) screen framebuffer, render the result into destination, for example with a ShaderPass or ShaderPipeline.


    Parameters

    Returns void