Type Alias TAmbientOcclusionOptions

TAmbientOcclusionOptions: {
    autoRenderBeauty?: boolean;
    color?: string;
    denoiseIterations?: number;
    denoiseRadius?: number;
    denoiseSamples?: number;
    depthAwareUpsampling?: boolean;
    enabled?: boolean;
    gammaCorrection?: boolean;
    intensity?: number;
    logarithmicDepthBuffer?: boolean;
    quality?:
        | "performance"
        | "low"
        | "medium"
        | "high"
        | "ultra";
    radius?: number;
    renderMode?: number;
    resolution?: "half" | "full";
    samples?: number;
    screenSpaceRadius?: boolean;
}

Represents all the available ambient occlusion options.

Type declaration

  • OptionalautoRenderBeauty?: boolean

    It is recommended to not change this value, otherwise rendering issues may occur.

  • Optionalcolor?: string

    The color of the ambient occlusion. By default, it is black, but it can be changed to any color to offer a crude approximation of global illumination. Recommended in scenes where bounced light has a uniform "color", for instance a scene that is predominantly lit by a blue sky. The color is expected to be in the sRGB color space, and is automatically converted to linear space for you. Keep the color pretty dark for sensible results.

    Color formats:
    RGB String: rgb(255, 0, 0) or rgb(100%, 0%, 0%)
    HSL String: hsl(0, 100%, 50%)
    X11 color name - all 140 color names are supported. Note the lack of CamelCase in the name: skyblue

  • OptionaldenoiseIterations?: number
  • OptionaldenoiseRadius?: number
  • OptionaldenoiseSamples?: number
  • OptionaldepthAwareUpsampling?: boolean

    The half aoResolution mode uses depth-aware upscaling by default. The AO effect looks bad without depth-aware upscaling, so it is not recommended to disable it. However, if performance is truly that critical, you can do so by setting depthAwareUpsampling to false.

  • Optionalenabled?: boolean

    Enable ambient occlusion. Only works in single buffer mode and when device supports WebGL2.

    false
    
  • OptionalgammaCorrection?: boolean

    Should be automatically set to the correct value. If you are getting washed out colors, try setting gammaCorrection to false, and if you are getting dark colors, try setting it to true.

  • Optionalintensity?: number

    A purely artistic control for the intensity of the AO has the effect of darkening areas with more ambient occlusion. Useful to make the effect more pronounced. An intensity of 2 generally produces soft ambient occlusion that isn't too noticeable, whereas one of 5 produces heavily prominent ambient occlusion.

  • OptionallogarithmicDepthBuffer?: boolean
  • Optionalquality?:
        | "performance"
        | "low"
        | "medium"
        | "high"
        | "ultra"

    Change the quality of ambient occlusion in the scene. Greater quality means less noise, but worse performance.

    The quality modes are as follows:

    Temporal stability refers to how consistent the AO is from frame to frame - it's important for a smooth experience.*

    Quality Mode AO Samples Denoise Samples Denoise Radius Best For
    Performance (Less temporal stability, a bit noisy) 8 4 12 Mobile, Low-end iGPUs and laptops
    Low (Temporally stable, but low-frequency noise) 16 4 12 High-End Mobile, iGPUs, laptops
    Medium (Temporally stable and barely any noise) 16 8 12 High-End Mobile, laptops, desktops
    High (Significantly sharper AO, barely any noise) 64 8 6 Desktops, dedicated GPUs
    Ultra (Sharp AO, No visible noise whatsoever) 64 16 6 Desktops, dedicated GPUs

    Generally, half-res mode at "Ultra" quality is slightly slower than full-res mode at "Performance" quality, but produces significantly better results.

    If you wish to make entirely custom quality setup, you can manually change aoSamples, denoiseSamples and denoiseRadius.

    'medium'
    
  • Optionalradius?: number

    Controls the radius/size of the ambient occlusion in world units. Should be set to how far you want the occlusion to extend from a given object. Set it too low, and AO becomes an edge detector. Too high, and the AO becomes "soft" and might not highlight the details you want.

  • OptionalrenderMode?: number
  • Optionalresolution?: "half" | "full"

    Use half-resolution" mode for performance-critical applications. This will cause the AO to be calculated at half the resolution of the screen, and then upscaled to the full resolution. This is a great way to get a performance boost (generally 2x-4x) at the cost of some quality (the AO will lack fine details and temporal stability will be slightly reduced).

    'full'
    
  • Optionalsamples?: number
  • OptionalscreenSpaceRadius?: boolean

    When screenSpaceRadius is set to true, the aoRadius parameter represents the size of the ambient occlusion effect in pixels (recommended to be set between 16 and 64). The distanceFalloff parameter becomes a ratio, representing the percent of the screen space radius at which the AO should fade away - it should be set to 0.2 in most cases, but it accepts any value between 0 and 1 (technically even higher than 1, though that is not recommended).