ScreenSpaceEffectBuilder Interface

An interface used to construct and register with the IModelApp.renderSystem a custom screen-space effect. Screen-space effects take as input the image rendered by a Viewport, as a WebGL texture, and execute a shader program to modify the image. Any number of screen-space effects can be registered, but each must have a unique name. Each Viewport has an ordered list of effects to be applied to it.

Each time a Viewport's contents are rendered, the RenderSystem does the following:

  • Render Viewport's contents to a texture.
  • For each effect name in Viewport.screenSpaceEffects:
    • Look up the corresponding registered effect.
    • If `shouldApply is defined and returns false, skip the effect. Otherwise:
    • For each Uniform defined by the effect, invoke its bind property to set its current value.
    • Bind the Viewport's rendered image to the uniform u_diffuse.
    • Execute the effect shader to alter the viewport's image. In this way, a series of multiple effects can be chained together, each consuming as input the image output by the previous effect.

A screen-space effect that moves pixels from their original locations rather than simply recoloring them may cause some tools to behave unexpectedly:

  • Element locate will only work correctly if ScreenSpaceEffectBuilderParams.sampleSourcePixel is properly defined.
  • Tools like the measurement tool that require snapping to element geometry will not snap correctly since the element geometry has been distorted by the shader.

@see - Screen-space Effects Sample for an interactive demonstration.

Properties

Name Type Description
addUniform (params: UniformParams) => void    
addUniformArray (params: UniformArrayParams) => void    
addVarying (name: string, type: VaryingType) => void    
finish () => void    
isWebGL2 Readonly boolean True if the shader will be used with a WebGL 2 rendering context. Deprecated  
shouldApply undefined | (context: ScreenSpaceEffectContext) => boolean    

Defined in

Last Updated: 25 April, 2024