@pixi/3d
    Preparing search index...

    Class FxaaEffect

    Smooths jagged edges by blurring along them, a cheap stand-in for multisampling

    Use it when the canvas has no antialias, or when a scene output's format turns MSAA off for the view (see SceneOutput). It works on the finished image only, so it costs one fullscreen pass whatever the scene holds.

    It runs after the tone curve by default, since it finds edges by their brightness on screen. Put it last among the 'afterToneMapping' effects: an effect after it can bring the jagged edges back.

    // On a canvas created with `antialias: false`
    view.passes = [new BloomEffect({ threshold: 0.5 }), new FxaaEffect()];

    Hierarchy (View Summary)

    Index
    enabled: boolean

    Whether this pass runs

    Flipping it rebuilds the view's render graph on the next render, which suits a settings toggle but not a change every frame; animate an effect's own properties instead. It can also recompile the view's materials; View3D#passes says when.

    const wireframe = new MeshPass({ name: 'wireframe' });
    view.passes = [wireframe];
    wireframe.enabled = false;
    inputMips: boolean = false

    Whether the effect's input has mips, for an effect that reads coarse levels with sampleColorLod, such as a blur

    Costs a mip generation every frame and about a third more memory for the input, so leave it false unless the effect samples levels above 0.

    requiredOutputs?: readonly SceneOutput[]

    Extra outputs the view's scene draw writes beside its colour while this pass is enabled

    Each costs the scene draw a texture and the shader work to fill it, and any output makes the view draw its scene into a texture first, as a post effect does. Reach an output's texture with RenderGraph#getSceneOutput, to read it or draw into it.

    const objectIdOutput: SceneOutput = { name: 'objectId', format: 'r32uint' };

    class MyPickingPass extends Pass3D {
    public readonly stage = 'afterTransparent';
    public readonly requiredOutputs = [objectIdOutput];
    public build(): void {}
    }

    The stage the effect runs at, set by the stage option

    defaultOptions: FxaaEffectOptions = ...

    Defaults for every new FxaaEffect; an option passed as undefined keeps its default

    FxaaEffect.defaultOptions.edgeSharpness = 4;
    
    • get edgeSharpness(): number

      How far the blend reaches along an edge, 8 (sharpest) down to 2 (softest)

      Returns number

      fxaa.edgeSharpness = 4;
      
    • set edgeSharpness(value: number): void

      Sets how far the blend reaches along an edge

      Parameters

      • value: number

        8 keeps the image sharpest, 2 blends furthest.

      Returns void

    • get edgeThreshold(): number

      Smallest contrast that counts as an edge, relative to the brightest pixel nearby; FxaaEffectOptions#edgeThreshold has the details

      Returns number

      fxaa.edgeThreshold = 0.166;
      
    • set edgeThreshold(value: number): void

      Sets the relative contrast an edge needs

      Parameters

      • value: number

        Fraction of the brightest nearby pixel's brightness.

      Returns void

    • get edgeThresholdMin(): number

      Smallest contrast that counts as an edge in any light

      Returns number

      fxaa.edgeThresholdMin = 0.04;
      
    • set edgeThresholdMin(value: number): void

      Sets the absolute contrast floor for an edge

      Parameters

      • value: number

        Brightness difference, 0 to 1.

      Returns void

    • Advanced

      Adds this effect's passes to the graph

      The default adds one FullscreenPass that draws fragment, binding the scene depth only when the fragment calls sampleDepth, viewPos or depthTexel by name. On an antialiased canvas, reading the depth costs a copy of it each frame, shared by every effect that reads it. Override it for a multi-pass effect, as the class docs show; Pass3D#build says when handles become textures.

      Parameters

      • graph: RenderGraph

        Render graph being built; add passes and transients to it.

      • io: EffectIO

        This effect's input and output, plus the renderer and opaque copies

      Returns void

    • Releases GPU resources the pass made outside the graph; the base class has none

      The view never calls it, not on replacing view.passes nor on its own destroy, since a pass can be shared. Call it yourself once the pass is retired. Override it only for resources of your own: the render passes added in build go with the view's graph, and a plain UniformGroup needs no release.

      Returns void

      view.passes = [];
      wireframe.destroy();