Class MSAARenderPass

MapView's MSAA implementation.

Remarks

MSAA stands for Multi Sampling Anti-Aliasing, and its concept is to provide a rendering engine with additional color values for each pixel, so they can include the missing bits between them on a screen. WebGL already comes with a native MSAA implementation with four samples. Because of its native nature, it is more efficient and one may not want to use MapView's MSAA implementation when these four samples are satisfying. However in some situations they are not: on low devices, MSAA can impact the framerate and we may desire to reduce the number of samples at runtime. On the other hand, when the interaction stops, the engine also stops rendering the map, and because a map relies on many line-like patterns, aliasing can then turn very noticeable. In such static renders, the number of samples could be dramatically increased on a last frame to render.

Hierarchy

  • Pass
    • MSAARenderPass

Constructors

Properties

enabled: boolean = false

Whether the Pass instance is active or not.

Default

true.

renderToScreen: boolean = false

Whether the render method should target a WebGLRenderTarget instance, or the frame buffer.

Default

false.

samplingLevel: MSAASampling = MSAASampling.Level_1

The sampling level determines the number of samples that will be performed per frame. Renders will happen 2 ^ samplingLevel time(s). samplingLevel stands between 0 and 5. Therefore there can be between 1 and 32 samples.

Default

SamplingLevel.Level_1

OffsetVectors: number[][][] = ...

The list of offsets to apply to the camera, per sampling level, adapted from :

Methods

  • The render function of MSAARenderPass.

    Parameters

    • renderer: WebGLRenderer

      The ThreeJS WebGLRenderer instance to render the scene with.

    • scene: Scene

      The ThreeJS Scene instance to render the scene with.

    • camera: PerspectiveCamera | OrthographicCamera

      The ThreeJS Camera instance to render the scene with.

    • writeBuffer: null | WebGLRenderTarget

      A ThreeJS WebGLRenderTarget instance to render the scene to.

    • readBuffer: WebGLRenderTarget

      A ThreeJS WebGLRenderTarget instance to render the scene.

    Returns void

    Remarks

    At each call of this method, and for each sample the MapView camera provided in the render method is offset within the dimension of a pixel on screen. It then renders the whole scene with this offset to a local WebGLRenderTargetinstance, via aWebGLRenderer` instance. Finally the local camera created in the constructor shoots the quad and renders to the write buffer or to the frame buffer. The quad material's opacity is modified so the renders can accumulate in the targetted buffer.

    The number of samples can be modified at runtime through the enum [[SamplingLevel]].

    If there is no further pass, the {@link Pass.renderToScreen} flag can be set to true to output directly to the framebuffer.

Generated using TypeDoc