Skip to content

Documentation / scene / SAO

Class: SAO

Defined in: libs/scene/src/posteffect/sao.ts:87

The Scalable Ambient Obscurance (SAO) post effect

Extends

Constructors

Constructor

new SAO(): SAO

Defined in: libs/scene/src/posteffect/sao.ts:105

Creates an instance of SAO post effect

Returns

SAO

Overrides

AbstractPostEffect.constructor

Properties

_enabled

protected _enabled: boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:118

Inherited from

AbstractPostEffect._enabled


_layer

protected _layer: PostEffectLayer

Defined in: libs/scene/src/posteffect/posteffect.ts:119

Inherited from

AbstractPostEffect._layer

Accessors

disposed

Get Signature

get disposed(): boolean

Defined in: libs/base/dist/index.d.ts:6107

Returns

boolean

Inherited from

AbstractPostEffect.disposed


enabled

Get Signature

get enabled(): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:130

Whether this post effect is enabled

Returns

boolean

Set Signature

set enabled(val): void

Defined in: libs/scene/src/posteffect/posteffect.ts:133

Parameters
val

boolean

Returns

void

Inherited from

AbstractPostEffect.enabled


layer

Get Signature

get layer(): PostEffectLayer

Defined in: libs/scene/src/posteffect/posteffect.ts:137

Whether this post effect will be rendered at opaque phase

Returns

PostEffectLayer

Inherited from

AbstractPostEffect.layer


intensity

Get Signature

get intensity(): number

Defined in: libs/scene/src/posteffect/sao.ts:124

Strength of the occlusion term added by each tap.

Returns

number

Set Signature

set intensity(val): void

Defined in: libs/scene/src/posteffect/sao.ts:127

Parameters
val

number

Returns

void


bias

Get Signature

get bias(): number

Defined in: libs/scene/src/posteffect/sao.ts:133

Threshold below which a sample does not occlude, in the range 0..1.

Returns

number

Set Signature

set bias(val): void

Defined in: libs/scene/src/posteffect/sao.ts:136

Parameters
val

number

Returns

void


occlusionRadius

Get Signature

get occlusionRadius(): number

Defined in: libs/scene/src/posteffect/sao.ts:142

World-space occlusion radius in metres.

Returns

number

Set Signature

set occlusionRadius(val): void

Defined in: libs/scene/src/posteffect/sao.ts:145

Parameters
val

number

Returns

void


blurKernelSize

Get Signature

get blurKernelSize(): number

Defined in: libs/scene/src/posteffect/sao.ts:149

Blur kernel size

Returns

number

Set Signature

set blurKernelSize(val): void

Defined in: libs/scene/src/posteffect/sao.ts:152

Parameters
val

number

Returns

void


blurStdDev

Get Signature

get blurStdDev(): number

Defined in: libs/scene/src/posteffect/sao.ts:158

Gaussian blur stddev value

Returns

number

Set Signature

set blurStdDev(val): void

Defined in: libs/scene/src/posteffect/sao.ts:161

Parameters
val

number

Returns

void


blurDepthCutoff

Get Signature

get blurDepthCutoff(): number

Defined in: libs/scene/src/posteffect/sao.ts:166

Cutoff of depth limited blur

Returns

number

Set Signature

set blurDepthCutoff(val): void

Defined in: libs/scene/src/posteffect/sao.ts:169

Parameters
val

number

Returns

void

Methods

on()

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

EventListener<{ dispose: []; }, K>

context?

unknown

Returns

void

Inherited from

AbstractPostEffect.on


once()

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

EventListener<{ dispose: []; }, K>

context?

unknown

Returns

void

Inherited from

AbstractPostEffect.once


off()

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener?

EventListener<{ dispose: []; }>

context?

unknown

Returns

void

Inherited from

AbstractPostEffect.off


dispatchEvent()

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters

K

K extends "dispose"

Parameters

type

K

args

...object[K]

Returns

void

Inherited from

AbstractPostEffect.dispatchEvent


dispose()

dispose(): void

Defined in: libs/base/dist/index.d.ts:6108

Returns

void

Inherited from

AbstractPostEffect.dispose


needFlip()

needFlip(device): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:145

Check if the post effect should be rendered upside down.

Parameters

device

AbstractDevice

The device object

Returns

boolean

true if the post effect should be rendered upside down

Inherited from

AbstractPostEffect.needFlip


requireMotionVectorTexture()

requireMotionVectorTexture(_ctx): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:166

Checks whether this post effect requires the motion vector texture

Parameters

_ctx

DrawContext

Returns

boolean

true if the motion vector texture is required.

Inherited from

AbstractPostEffect.requireMotionVectorTexture


requireHiZTexture()

requireHiZTexture(_ctx): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:170

Checks whether this post effect requires the Hi-Z depth pyramid.

Parameters

_ctx

DrawContext

Returns

boolean

Inherited from

AbstractPostEffect.requireHiZTexture


requireHiZNearest()

requireHiZNearest(_ctx): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:181

Checks whether this post effect requires the Hi-Z pyramid's nearest-depth channel, which answers "how close is the nearest surface in this screen region" rather than the farthest-depth channel's occlusion question.

Implies AbstractPostEffect.requireHiZTexture; an effect that needs the nearest channel does not have to request the pyramid separately.

Parameters

_ctx

DrawContext

Returns

boolean

Inherited from

AbstractPostEffect.requireHiZNearest


requireSceneNormalTexture()

requireSceneNormalTexture(_ctx): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:185

Checks whether this post effect requires opaque-scene world normals.

Parameters

_ctx

DrawContext

Returns

boolean

Inherited from

AbstractPostEffect.requireSceneNormalTexture


requireSceneRoughnessTexture()

requireSceneRoughnessTexture(_ctx): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:189

Checks whether this post effect requires opaque-scene roughness data.

Parameters

_ctx

DrawContext

Returns

boolean

Inherited from

AbstractPostEffect.requireSceneRoughnessTexture


requireShadowMask()

requireShadowMask(_ctx): boolean

Defined in: libs/scene/src/posteffect/posteffect.ts:200

Checks whether this post effect requires the screen-space shadow mask.

When true and the mask was produced this frame, the effect can sample DrawContext.shadowMaskTexture in its apply() body; the graph keeps the mask alive for the effect's pass.

Parameters

_ctx

DrawContext

Returns

boolean

true if the shadow mask is required.

Inherited from

AbstractPostEffect.requireShadowMask


setup()

setup(s): RGHandle

Defined in: libs/scene/src/posteffect/posteffect.ts:239

Declare this effect's passes on the render graph.

The default implementation wraps AbstractPostEffect.apply into a single graph pass, so effects only overriding apply() work unchanged. Multi-pass effects override this method to declare each internal step as its own pass, calling PostEffectSetupContext.createOutput inside the final pass.

Parameters

s

PostEffectSetupContext

Build-time setup context.

Returns

RGHandle

The effect's output color handle.

Inherited from

AbstractPostEffect.setup


passThrough()

protected passThrough(ctx, inputColorTexture, srgbOutput, renderStates?): void

Defined in: libs/scene/src/posteffect/posteffect.ts:344

Parameters

ctx

DrawContext

Draw context

inputColorTexture

Texture2D

Input color texture

srgbOutput

boolean

Whether the result should be gamma corrected

renderStates?

RenderStateSet

Returns

void

Inherited from

AbstractPostEffect.passThrough


drawFullscreenQuad()

protected drawFullscreenQuad(renderStateSet?): void

Defined in: libs/scene/src/posteffect/posteffect.ts:363

Draws a fullscreen quad

Parameters

renderStateSet?

RenderStateSet

Render states that will be used when drawing the fullscreen quad.

Returns

void

Inherited from

AbstractPostEffect.drawFullscreenQuad


onDispose()

protected onDispose(): void

Defined in: libs/scene/src/posteffect/posteffect.ts:376

Returns

void

Inherited from

AbstractPostEffect.onDispose


requireLinearDepthTexture()

requireLinearDepthTexture(): boolean

Defined in: libs/scene/src/posteffect/sao.ts:173

Checks whether this post effect requires the linear depth texture

Returns

boolean

true if the linear depth texture is required.

Overrides

AbstractPostEffect.requireLinearDepthTexture


requireDepthAttachment()

requireDepthAttachment(): boolean

Defined in: libs/scene/src/posteffect/sao.ts:177

Checks whether this post effect requires the scene depth buffer

Returns

boolean

true if the scene depth buffer is required.

Overrides

AbstractPostEffect.requireDepthAttachment


apply()

apply(ctx, inputColorTexture, sceneDepthTexture, srgbOutput): void

Defined in: libs/scene/src/posteffect/sao.ts:181

Apply the post effect

Parameters

ctx

DrawContext

inputColorTexture

Texture2D

The previous scene color texture

sceneDepthTexture

Texture2D

The linear scene depth texture

srgbOutput

boolean

Whether the result should be gamma corrected

Returns

void

Remarks

The frame buffer of the post effect is already set when apply() is called.

Overrides

AbstractPostEffect.apply

Released under the MIT License.