Viewer
    Preparing search index...

    Class DepthOfFieldEffect

    A depth of field effect.

    Based on a graphics study by Adrian Courrèges and an article by Steve Avery: https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/ https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructs a new depth of field effect.

      Parameters

      • Optionalcamera: Camera

        The main camera.

      • Optionaloptions: {
            blendFunction?: BlendFunction;
            bokehScale?: number;
            focalLength?: number;
            focusDistance?: number;
            focusRange?: number;
            height?: number;
            resolutionScale?: number;
            resolutionX?: number;
            resolutionY?: number;
            width?: number;
            worldFocusDistance?: number;
            worldFocusRange?: number;
        }

        The options.

        • OptionalblendFunction?: BlendFunction

          The blend function of this effect.

        • OptionalbokehScale?: number

          The scale of the bokeh blur.

        • OptionalfocalLength?: number

          Deprecated. Use focusRange instead.

        • OptionalfocusDistance?: number

          The focus distance in world units.

        • OptionalfocusRange?: number

          The focus range in world units.

        • Optionalheight?: number

          Deprecated. Use resolutionY instead.

        • OptionalresolutionScale?: number

          The resolution scale.

        • OptionalresolutionX?: number

          The horizontal resolution.

        • OptionalresolutionY?: number

          The vertical resolution.

        • Optionalwidth?: number

          Deprecated. Use resolutionX instead.

        • OptionalworldFocusDistance?: number

          Deprecated. Use focusRange instead.

        • OptionalworldFocusRange?: number

          Deprecated. Use focusRange instead.

      Returns DepthOfFieldEffect

    Properties

    blendMode: BlendMode

    The blend mode of this effect.

    blurPass: KawaseBlurPass

    This pass blurs the foreground CoC buffer to soften edges.

    defines: Map<string, string>

    Preprocessor macro definitions.

    Call Effect.setChanged after changing macro definitions.

    extensions: Set<WebGLExtension>

    WebGL extensions that are required by this effect.

    Call Effect.setChanged after adding or removing extensions.

    name: string

    The name of this effect.

    renderer: WebGLRenderer

    The renderer.

    target: Vector3 | null

    A target position that should be kept in focus. Set to null to disable auto focus.

    uniforms: Map<string, Uniform<any>>

    Shader uniforms.

    Call Effect.setChanged after adding or removing uniforms.

    Accessors

    • get bokehScale(): number

      The bokeh scale.

      Returns number

    • set bokehScale(arg: number): void

      Parameters

      • arg: number

      Returns void

    • get cocTexture(): Texture

      The circle of confusion texture.

      Returns Texture

    Methods

    • Calculates the focus distance from the camera to the given position.

      Parameters

      Returns number

      The focus distance in world units.

    • Performs a shallow search for properties that define a dispose method and deletes them.

      The EffectComposer calls this method when it is being destroyed.

      Returns void

    • Returns the blend mode.

      The result of this effect will be blended with the result of the previous effect using this blend mode.

      Returns BlendMode

      The blend mode.

      Use blendMode instead.

    • Returns the pass that blurs the foreground CoC buffer to soften edges.

      Returns KawaseBlurPass

      The blur pass.

      Use blurPass instead.

    • Returns the current bokeh scale.

      Returns number

      The scale.

      Use bokehScale instead.

    • Returns the preprocessor macro definitions.

      Returns Map<string, string>

      The extensions.

      Use defines instead.

    • Returns the fragment shader.

      Returns string

      The fragment shader.

    • Returns the name of this effect.

      Returns string

      The name.

      Use name instead.

    • Returns the resolution settings.

      Returns Resolution

      The resolution.

      Use resolution instead.

    • Returns the current auto focus target.

      Returns Vector3

      The target.

      Use target instead.

    • Returns the uniforms of this effect.

      Returns Map<string, Uniform<any>>

      The extensions.

      Use uniforms instead.

    • Returns the vertex shader.

      Returns string

      The vertex shader.

    • Performs initialization tasks.

      Parameters

      • renderer: WebGLRenderer

        The renderer.

      • alpha: boolean

        Whether the renderer uses the alpha channel or not.

      • frameBufferType: number

        The type of the main frame buffers.

      Returns void

    • Protected

      Sets the effect attributes.

      Effects that have the same attributes will be executed in the order in which they were registered. Some attributes imply a higher priority.

      Parameters

      Returns void

    • Sets the bokeh scale.

      Parameters

      • value: number

        The scale.

      Returns void

      Use bokehScale instead.

    • Protected

      Informs the associated EffectPass that this effect requires a shader recompilation.

      Should be called after changing macros or extensions and after adding/removing uniforms.

      Returns void

    • Protected

      Sets the fragment shader.

      Parameters

      • fragmentShader: string

        The fragment shader.

      Returns void

    • Updates the size of internal render targets.

      Parameters

      • width: number

        The width.

      • height: number

        The height.

      Returns void

    • Sets the auto focus target.

      Parameters

      Returns void

      Use target instead.

    • Protected

      Sets the vertex shader.

      Parameters

      • vertexShader: string

        The vertex shader.

      Returns void

    • Updates this effect.

      Parameters

      • renderer: WebGLRenderer

        The renderer.

      • inputBuffer: WebGLRenderTarget

        A frame buffer that contains the result of the previous pass.

      • OptionaldeltaTime: number

        The time between the last frame and the current one in seconds.

      Returns void