Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Implements

Index

Constructors

constructor

Properties

enabled

enabled: boolean = false

renderToScreen

renderToScreen: boolean = false

samplingLevel

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

Static Readonly OffsetVectors

OffsetVectors: number[][][] = [[[0, 0]],[[4, 4],[-4, -4]],[[-2, -6],[6, -2],[-6, 2],[2, 6]],[[1, -3],[-1, 3],[5, 1],[-3, -5],[-5, 5],[-7, -1],[3, 7],[7, -7]],[[1, 1],[-1, -3],[-3, 2],[4, -1],[-5, -2],[2, 5],[5, 3],[3, -5],[-2, 6],[0, -7],[-4, -6],[-6, 4],[-8, 0],[7, -4],[6, 7],[-7, -8]],[[-4, -7],[-7, -5],[-3, -5],[-5, -4],[-1, -4],[-2, -2],[-6, -1],[-4, 0],[-7, 1],[-1, 2],[-6, 3],[-3, 3],[-7, 6],[-3, 6],[-5, 7],[-1, 7],[5, -7],[1, -6],[6, -5],[4, -4],[2, -3],[7, -2],[1, -1],[4, -1],[2, 1],[6, 2],[0, 4],[4, 4],[2, 5],[7, 5],[5, 6],[3, 7]]]

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

see

https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Methods

dispose

  • dispose(): void

render

  • render(renderer: WebGLRenderer, scene: Scene, camera: PerspectiveCamera | OrthographicCamera, writeBuffer: WebGLRenderTarget | null, readBuffer: WebGLRenderTarget): void
  • The render function of MSAARenderPass.

    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 localWebGLRenderTargetinstance, 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 Pass.renderToScreen flag can be set to true to output directly to the framebuffer.

    override

    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: WebGLRenderTarget | null

      A ThreeJS WebGLRenderTarget instance to render the scene to.

    • readBuffer: WebGLRenderTarget

      A ThreeJS WebGLRenderTarget instance to render the scene.

    Returns void

setSize

  • setSize(width: number, height: number): void

Generated using TypeDoc