GBuffer

GBuffer

# new GBuffer()

Source:

GBuffer is provided for deferred rendering and SSAO, SSR pass. It will do three passes rendering to four target textures. See

Extends

Members

# __uid__ :number

Source:
Inherited From:
Type:
  • number

# enableTargetTexture1 :boolean

Source:

If enable gbuffer texture 1.

Type:
  • boolean

# enableTargetTexture2 :boolean

Source:

If enable gbuffer texture 2.

Type:
  • boolean

# enableTargetTexture3 :boolean

Source:

If enable gbuffer texture 3.

Type:
  • boolean

# enableTargetTexture4 :boolean

Source:

If enable gbuffer texture 4.

Type:
  • boolean

Methods

# after(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of once('after' + name)

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# before(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of once('before' + name)

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# dispose(renderer)

Source:
Parameters:
Name Type Description
renderer clay.Renderer

# error(action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of on('error')

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# getTargetTexture1() → {clay.Texture2D}

Source:

Get first target texture. Channel storage:

  • R: normal.x * 0.5 + 0.5
  • G: normal.y * 0.5 + 0.5
  • B: normal.z * 0.5 + 0.5
  • A: glossiness
Returns:
Type
clay.Texture2D

# getTargetTexture2() → {clay.Texture2D}

Source:

Get second target texture. Channel storage:

  • R: depth
Returns:
Type
clay.Texture2D

# getTargetTexture3() → {clay.Texture2D}

Source:

Get third target texture. Channel storage:

  • R: albedo.r
  • G: albedo.g
  • B: albedo.b
  • A: metalness
Returns:
Type
clay.Texture2D

# getTargetTexture4() → {clay.Texture2D}

Source:

Get fourth target texture. Channel storage:

  • R: velocity.r
  • G: velocity.g
Returns:
Type
clay.Texture2D

# has(name, action) → {boolean}

Source:
Inherited From:
Mixes In:

If registered the event handler

Parameters:
Name Type Description
name string
action function
Returns:
Type
boolean

# off(action, contextopt)

Source:
Inherited From:
Mixes In:

Remove event listener

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# on(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Register event handler

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# once(name, action, contextopt)

Source:
Inherited From:
Mixes In:

Register event, event will only be triggered once and then removed

Parameters:
Name Type Attributes Description
name string
action function
context Object <optional>

# renderDebug(renderer, camera, typeopt)

Source:

Debug output of gBuffer. Use type parameter to choos the debug output type, which can be:

  • 'normal'
  • 'depth'
  • 'position'
  • 'glossiness'
  • 'metalness'
  • 'albedo'
  • 'velocity'
Parameters:
Name Type Attributes Default Description
renderer clay.Renderer
camera clay.Camera
type string <optional>
'normal'

# resize(width, height)

Source:

Set G Buffer size.

Parameters:
Name Type Description
width number
height number

# success(action, contextopt)

Source:
Inherited From:
Mixes In:

Alias of on('success')

Parameters:
Name Type Attributes Description
action function
context Object <optional>

# trigger(name)

Source:
Inherited From:
Mixes In:

Trigger event

Parameters:
Name Type Description
name string

# update(renderer, scene, camera, opts)

Source:

Update GBuffer

Parameters:
Name Type Description
renderer clay.Renderer
scene clay.Scene
camera clay.Camera
opts Object