AmbientOcclusionSettings class Rendering

Screen-space ambient occlusion settings for a Scene.

Reachable through Scene.ambientOcclusion. Ambient occlusion darkens the indirect (image-based) lighting in creases, cavities, and contact points that the smooth environment term would otherwise leave evenly lit. The result reads as soft contact shadowing on edges and concave geometry.

Disabled by default: a fresh scene does no ambient-occlusion work and adds no render passes. Set enabled to turn it on.

Two estimators are available through method. Both take only a depth buffer (the per-pixel normal is reconstructed from depth), so they fit a forward renderer with no normal buffer, and both run as full-screen fragment passes with no compute.

Constructors

AmbientOcclusionSettings()

Properties

bentNormals bool
Also computes the bent normal (the average unoccluded direction) and carries it with the occlusion. Indirect diffuse then samples irradiance along the bent normal, so occluded surfaces stop picking up light from directions that are blocked, and SpecularAmbientOcclusionMode.bentCone becomes available. The bent normal is geometric (reconstructed from depth), so it does not carry normal-map detail. Only used by AmbientOcclusionMethod.groundTruth when visibilityBitmask is disabled.
getter/setter pair
bias double
Distance, in world units, a sampled surface must sit in front of the shaded point before it counts as an occluder. Lifts the estimate off the surface so a flat plane does not occlude itself.
getter/setter pair
depthMipChain bool
Renders the depth prepass at full resolution and samples it through a downsampled mip chain (a level per sample distance), instead of rasterising the depth at the occlusion resolution.
getter/setter pair
detail double
Strength of the four immediate-neighbour samples. This restores tight contact detail that the wider sampling disk and blur can soften.
getter/setter pair
directLightAffect double
Fraction of screen-space occlusion applied to analytic direct lights. 0.0 affects indirect lighting only, while 1.0 affects both equally.
getter/setter pair
enabled bool
Whether ambient occlusion runs. Off by default. When false the scene adds no ambient-occlusion passes and the lighting is unaffected.
getter/setter pair
halfResolution bool
Evaluates the occlusion buffer at half resolution and bilaterally upsamples it, cutting the occlusion pixel work to a quarter at the cost of fine detail. Recommended on mobile.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
horizonAngle double
Minimum sine of the sample angle above the surface horizon. Samples closer to tangent are rejected to prevent shallow surfaces from self-occluding because of depth precision and coarse tessellation.
getter/setter pair
indirectLight double
Strength of one-bounce screen-space indirect light gathered along the occlusion march, 0.0 (the default) disabling it. Radiance from the previous frame's scene color is credited to each newly visible sector, so lit surfaces bleed their color onto neighbors. Requires AmbientOcclusionMethod.groundTruth with visibilityBitmask; while active the chain renders in half-float and the sun's contact shadows are unavailable (the channels carry radiance instead). TODO(ssgi-reprojection): the radiance is sampled unreprojected, so fast camera motion drags the bounce by one frame.
getter/setter pair
intensity double
Nonnegative scalar on the occlusion strength. 1.0 is each method's calibrated look (AmbientOcclusionMethod.groundTruth matches ray-traced visibility there; AmbientOcclusionMethod.obscurance is normalized to its tuned strength), so the same value reads consistently across both methods. 0.0 removes screen-space occlusion. Output obscurance saturates at 0.98 before power is applied.
getter/setter pair
method AmbientOcclusionMethod
Which occlusion estimator runs. See AmbientOcclusionMethod.
getter/setter pair
multiBounce double
How much bounce light the occluded indirect diffuse term keeps, from 0.0 (occlusion darkens toward black) to 1.0 (occlusion converges toward the surface albedo, so creases keep color instead of going gray). Uses the fitted multi-bounce model from Jimenez et al. 2016.
getter/setter pair
power double
Contrast power applied to the final visibility. Values above 1.0 deepen already-occluded regions without increasing the raw estimate.
getter/setter pair
radius double
World-space radius the occlusion is gathered over. Larger values darken broader cavities; smaller values keep occlusion to tight contact creases.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleCount int
Number of samples taken per pixel. More samples cut noise at a roughly linear cost. Reasonable values are about 8 to 32.
getter/setter pair
sliceCount int
Number of hemisphere slices integrated per pixel by AmbientOcclusionMethod.groundTruth. More slices cut directional noise at a linear cost. Reasonable values are 2 to 4; the shader caps at 8.
getter/setter pair
specularMode SpecularAmbientOcclusionMode
How indirect specular reflections are occluded. See SpecularAmbientOcclusionMode.
getter/setter pair
stepsPerSlice int
Depth samples marched along each side of a slice by AmbientOcclusionMethod.groundTruth. More steps resolve occluders more precisely across the radius. Reasonable values are 2 to 4; the shader caps at 8.
getter/setter pair
thickness double
Assumed occluder thickness in world units when visibilityBitmask is enabled. Surfaces stop occluding the hemisphere beyond this depth behind their front face.
getter/setter pair
thicknessHeuristic double
How quickly a horizon decays when the march walks past an occluder, from 0.0 (horizons never decay, thin occluders over-darken) to 1.0 (each farther sample fully replaces the horizon). Small values are enough. Only used by AmbientOcclusionMethod.groundTruth when visibilityBitmask is disabled.
getter/setter pair
visibilityBitmask bool
Models occluders as surfaces with a constant thickness instead of an infinitely thick height field, by marking occluded sectors of the hemisphere in a per-slice bitmask. Cuts the over-darkening that thin geometry (wires, leaves, thin frames) casts at the cost of losing the cosine weighting of the closed-form arc integration. Only used by AmbientOcclusionMethod.groundTruth.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited