The “G” stands for “Graphics” and it’s only there to make it clear that it’s a different type that three’s Pass.

Accessors

clearAlpha

get clearAlpha(): number | undefined

Gets the current alpha clear value for the pass. If the value is undefined the pass will not clear alpha

Returns: number | undefined

clearColor

get clearColor(): number | undefined

Gets the current clear color value for the pass. If the value is undefined the pass will not clear color.

The color is represented as a number where:

  • R = value & 0xFF0000
  • G = value & 0x00FF00
  • B = value & 0x0000FF

Returns: number | undefined

clearFlags

get clearFlags(): number | undefined

Gets the current flags that determine what gets cleared by the pass. The value returned is a mask with the possibly OR-ed WebGL constant values for COLOR_BUFFER_BIT DEPTH_BUFFER_BIT and STENCIL_BUFFER_BIT

Returns: number | undefined

displayName

get displayName(): string

Gets the display name of the pass.

Returns: string

enabled

get enabled(): boolean
set enabled(value: boolean)

Gets the enabled state of the pass. A disabled pass will not be rendered by the hosting pipeline

Returns: boolean

jitter

get jitter(): boolean

Gets the jitter state of the pass. If jitter is enabled, the pipeline will apply Hatlon jitter to the projection matrix

Returns: boolean

options

get options(): PassOptions

Gets the pass options. PassOptions

Returns: PassOptions

outputTarget

get outputTarget(): WebGLRenderTarget | null
set outputTarget(value: WebGLRenderTarget)

Gets or sets the render target the pass writes to. If null it will write to the backbuffer

Returns: WebGLRenderTarget | null

overrideBatchMaterial

get overrideBatchMaterial(): Material | null

Gets the material that will override the default material of batches in the scene. This allows the pass to combine it’s defined override material with filters or other externally applied materials. If null, nothing gets overriden

Returns: Material | null

overrideMaterial

get overrideMaterial(): Material | null

Gets the material that will override all materials. If the overriden material is defined, it will completely replace any existing materials on the batches and no other effects that apply materials on objects will be made visible in this pass’s render result. If null, nothing gets overriden

Returns: Material | null

visibility

get visibility(): ObjectVisibility | null

Gets the current visibility state for the pass. If null, no visibility restrictions will be applied to the pass’s rendering, i.e everything gets rendered

Returns: ObjectVisibility | null

Methods

onAferRender

onAferRender: () => void

Callback for after rendering the pass

Returns: void

onBeforeRender

onBeforeRender: () => void

Callback for before rendering the pass

Returns: void

render

render(
   renderer: WebGLRenderer,
   camera?: PerspectiveCamera | OrthographicCamera | null,
   scene?: Scene
): boolean

The pass’s render function.

Parameters:

  • renderer: The hosting WebGLRenderer
  • optional camera: The rendering camera.
  • optional scene: The scene to render

Returns: boolean - If true, it signals that the pass needs more rendering, false otherwise.

setClearColor

setClearColor(color: number, alpha: number): void

Sets the pass’s clear color and alpha.

Clearing will be executed on whatever the current outputTarget value is. If outputTarget is null, the backbuffer will be cleared!

Parameters:

  • color: The color to clear with represented as a number where:
    • R = value & 0xFF0000
    • G = value & 0x00FF00
    • B = value & 0x0000FF
  • alpha: The alpha value to clear with in the range [0, 1]

Returns: void

setClearFlags

setClearFlags(flags: number): void

Sets the clear flags. The ClearFlags values can be used for ease of use.

Parameters:

  • flags: The value for the flags as previously detailed

Returns: void

setClippingPlanes

setClippingPlanes(planes: Plane[]): void

Sets the current clipping planes, if any exist

Parameters:

Returns: void

setJitter

setJitter(value: boolean): void

Enables/disables jittering for the pass

Returns: void

setLayers

setLayers?(layers: ObjectLayers[]): void

The the exclusive layers this pass will render. If no layers are set, all layers get rendered

Parameters:

Returns: void

setSize

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

Sets the rendering size for this pass.

Parameters:

  • width: number - The width of the rendering size.
  • height: number - The height of the rendering size.

Returns: void

setVisibility

setVisibility(objectVisibility: ObjectVisibility): void

Sets the exclusive visibility of the pass. Currently just a single visibility option can be set.

Parameters:

Returns: void

update

update(camera: PerspectiveCamera | OrthographicCamera | null): void

The pass’s update function. Generally used for updating pass related data before the render call

Parameters:

  • camera: The rendering camera.

Returns: void

Typedefs

ClearFlags

enum ClearFlags {
  COLOR = 0x00000100,
  DEPTH = 0x00000400,
  STENCIL = 0x00004000
}

The WebGL constant values for the clear flags for convenience

ObjectVisibility

enum ObjectVisibility {
  OPAQUE = 'opaque',
  TRANSPARENT = 'transparent',
  DEPTH = 'depth',
  STENCIL = 'stencil'
}

An object visibility categorization. Used to restrict pass rendering to only specific object lists

PassOptions

interface PassOptions {}

This can be virtually anything, and it’s up for the concrete pass implementations to define their own options.