The constructor for MSAARenderPass
. It builds an internal scene with a camera looking at a
quad.
Whether the Pass instance is active or not.
true
.
Whether the render method should target a WebGLRenderTarget instance, or the frame buffer.
false
.
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.
SamplingLevel.Level_1
Static
Readonly
OffsetThe list of offsets to apply to the camera, per sampling level, adapted from :
The render function of MSAARenderPass
.
The ThreeJS WebGLRenderer instance to render the scene with.
The ThreeJS Scene instance to render the scene with.
The ThreeJS Camera instance to render the scene with.
A ThreeJS WebGLRenderTarget instance to render the scene to.
A ThreeJS WebGLRenderTarget instance to render the scene.
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 a
WebGLRenderer` 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
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.