Screen Space Ambient Occlusion - ApertureViewer/Aperture-Viewer GitHub Wiki

Snapshot_009

Understanding Screen Space Ambient Occlusion (SSAO): System Analysis & Optimization

Document Version: 1.0 Basis: Analysis of codebase (Second Life open-source derived) and extensive in-application visual testing and validation within Aperture Viewer.


1. Overview of SSAO

Function/Purpose

Screen Space Ambient Occlusion (SSAO) is a real-time rendering technique designed to approximate the visual effect of ambient occlusion (AO). AO simulates the attenuation of ambient light (indirect environmental light) due to occlusion by nearby geometry. This results in the subtle darkening of areas such as creases, crevices, corners, and points where objects make contact or are in close proximity. The effect enhances the perception of depth, volume, and surface detail, adding a degree of realism and grounding objects within the scene without the significant computational expense of true global illumination or ray-traced AO.

Implementation Context

Within the Second Life viewer architecture (and thus Aperture Viewer), SSAO is implemented as a post-processing effect, typically integrated into the deferred shading pipeline. When active, an additional rendering pass is performed, usually after the G-Buffer (geometry buffer) has been populated. This SSAO pass calculates an occlusion factor for each relevant pixel on the screen. This occlusion factor is subsequently used during the final lighting composition stage to modulate the contribution of ambient or indirect light sources (such as skylight or light from environment probes), thereby darkening areas that the SSAO system determines to be occluded based on its parameters.

Source of Findings

[!IMPORTANT] While initial codebase analysis provided foundational context, the detailed understanding of parameter behavior, their interactions, resulting artifacts, and effective usage strategies presented in this document is derived primarily from direct, empirical visual testing and validation performed within the Aperture Viewer application itself. Several settings exhibited behaviors that differed significantly from initial intuition or a simplified interpretation of their underlying code variables, making in-application observation and testing the definitive source for this comprehensive analysis.


2. Core SSAO Settings Analysis (Based on In-Application Testing)

This section details the parameters controlling the SSAO effect, as found in Aperture Viewer's Phototools Suite (Lighting (Shd) Tab). The described behaviors are based on observed visual results within the application.


2.1. Enable Screen Space Ambient Occlusion (Master Switch)

  • UI Control: Checkbox typically labeled "Enable Screen Space Ambient Occlusion".
  • Observed Behavior: Functions as the master toggle for the entire SSAO system.
    • Disabled (false / unchecked): Completely bypasses all SSAO calculations and rendering passes. No AO effect is visible.
    • Enabled (true / checked): Activates the SSAO system, allowing the subsequent parameters to influence the effect.
  • Validation Method: Toggling the setting on and off and observing the clear presence or absence of the AO effect, as well as its corresponding impact on rendering performance (e.g., change in Frames Per Second - FPS).
  • Conclusion: Behaves as expected; a necessary prerequisite for all other SSAO settings to have an effect.

2.2. Samples (Quality vs. Performance)

  • UI Control: Slider/Spinner typically labeled "Samples" (e.g., APRenderSSAOSampleCount in Aperture).
  • Observed Behavior: Directly controls the number of depth samples taken per pixel during the SSAO calculation pass. This parameter is the primary determinant of SSAO quality versus its performance cost.
    • Higher values (e.g., 32, 64, 128+): Visually result in significantly smoother, more stable, and less noisy ambient occlusion. Artifacts like patchiness, flickering (especially during camera motion), and banding in gradients are substantially reduced or eliminated. Higher sample counts are essential for high-quality, clean AO, particularly when viewing subjects or scenes at close distances.
    • Lower values (e.g., 8, 16): Lead to noticeable noise (a granular or dithered pattern), patchiness (splotchy AO), and potential banding artifacts in areas of subtle occlusion or smooth gradients. These artifacts become drastically more apparent and visually detrimental when viewing subjects up close (e.g., sub ~5 meters).
  • Validation Method: Systematically increasing and decreasing the sample count while observing the AO effect's smoothness, stability, and noise level across various surfaces and at different camera distances. Performance (FPS) was correlated with sample count changes.
  • Conclusion: Higher sample counts vastly improve visual quality by reducing noise and artifacts, especially for close-up views, but at a significant, often non-linear, performance cost. An adequate sample count is critical for mitigating visual artifacts. Aperture Viewer's presets tune this for balance (e.g., 18 samples in "Eye Candy" for good close-up AO).

2.3. Scale (Sampling Radius & Reach)

  • UI Control: Slider/Spinner typically labeled "Scale".
  • Observed Behavior: Controls the base radius in screen space from which depth samples are taken around each pixel to determine occlusion. This influences the spatial "reach" or extent of the AO effect (the effect is scaled inversely by distance, so this base scale is more influential for nearby objects).
    • Lower values (e.g., < 300, particularly 100-200): Produce tighter, sharper AO shadows that are localized to immediate crevices, contact points, and fine geometric details. This setting is best for emphasizing subtle surface variations and detailed occlusion. Crucially, in-application visual testing revealed that lower Scale values are critical for mitigating or eliminating specific banding artifacts observed at close ranges, even when sample counts are high.
    • Higher values (e.g., > 400-500): Create softer, broader AO shadows that capture occlusion from slightly larger and more distant forms. This can be more suitable for distant views or when a less detailed, more diffuse AO effect is desired. However, visual testing clearly showed that high Scale values can exacerbate banding artifacts and cause excessive softness, blurriness, or even "haloing" when viewed up close.
  • Validation Method: Adjusting the Scale value and observing the spatial extent (reach), sharpness/softness of AO shadows. Specific attention was paid to the appearance of banding artifacts at various viewing distances, especially close-ups (sub ~5 meters).
  • Conclusion: Scale controls the reach and sharpness of the AO. Visual testing is definitive: while higher scales can provide softer, more visible distant AO, they often introduce banding and undesirable blurriness up close. Very low scales (e.g., <100) might be necessary in some extreme close-up scenarios to eliminate banding, at the cost of a much more localized effect. For general realism focusing on local occlusion, lower-to-moderate scales are usually preferred.

2.4. Max Scale (Close-up Radius Clamp)

  • UI Control: Slider/Spinner typically labeled "Max Scale".
  • Observed Behavior: Clamps the maximum screen-space pixel radius that can be used for SSAO sampling. This prevents the effective sampling radius (which is generally Scale / distance) from becoming excessively large for objects very close to the camera.
  • Validation Method: Observing AO behavior in extreme close-up situations with varying Scale and Max Scale values.
  • Conclusion: Acts as a necessary limiter, preventing excessive blurring, haloing, or performance degradation when objects are extremely close to the camera and the base Scale is high. It works as expected in conjunction with Scale.

2.5. Factor (Overall Intensity Multiplier)

  • UI Control: Slider/Spinner typically labeled "Factor".
  • Observed Behavior: Influences the overall intensity and contrast of the final AO darkening effect.
    • Factor = 0: Results in almost no visible AO effect, regardless of other settings.
    • Factor = 1: Produces a very subtle AO effect (depending on other intensity controls).
    • Increasing Factor (e.g., towards 5.0): Makes the AO progressively darker and higher contrast.
    • Very High Factor (e.g., values approaching or exceeding 10, up to 250 as tested historically): Visual testing clearly demonstrated that excessively high Factor values cause severe visual artifacts. These include unrealistic harshness, overly black shadows, and most notably, "bleeding" or "leaking" artifacts, where AO darkening appears on distant, unrelated surfaces (like terrain or sky far behind the foreground object), especially when combined with a large Scale.
  • Validation Method: Comparing scenes with Factor set to 0, 1, and much higher values. Specific attention was paid to shadow intensity, realism, and the presence of bleeding artifacts onto distant geometry in high Factor scenarios.
  • Conclusion: Factor controls overall AO intensity. Crucially, visual testing proves that extremely high Factor values are unsuitable for realistic or artifact-free results due to the generation of bleeding artifacts. Low-to-moderate values (typically in the range of 1 to 5, depending on other settings) provide usable intensity control without these severe issues.

2.6. Effect (Primary Darkness Control - Counter-Intuitive)

  • UI Control: Slider/Spinner typically labeled "Effect".
  • Observed Behavior: This slider directly controls the darkness or strength of the AO shadows, but its mapping is counter-intuitive based on typical UI conventions.
    • Effect = 0.0: Results in minimal or no visible AO darkening. The AO effect is effectively off in terms of shadow contribution.
    • Effect = -1.0 (Negative One): Produces clearly visible, moderately dark AO shadows. This is often a good starting point for visible AO.
    • More negative values (e.g., -1.5, -2.0): Increase the darkness and prominence of the AO shadows.
    • Positive values tend to make shadows non-existent or can even produce inverted/brightening artifacts if not clamped properly in the shader.
  • Validation Method: Comparing images side-by-side where only the Effect slider was changed (e.g., from -1.0 to 0.0, and from -1.0 to -2.0) and observing the drastic change in shadow visibility and intensity.
  • Conclusion: Visual testing is definitive: this slider works inversely to typical "strength" or "brightness" controls. 0.0 effectively turns the AO darkening off, while negative values turn it on and increase its strength. This observed behavior overrides any interpretation based solely on underlying code variable names (which might suggest a simple "ValueMultiplier").

2.7. Irrad. Scale (Irradiance Scale / Shadow Lightening - Counter-Intuitive)

  • UI Control: Slider/Spinner typically labeled "Irrad. Scale".
  • Observed Behavior: Modulates the final brightness within the AO shadowed areas, effectively acting as a control that lightens the AO shadows. Its behavior is also counter-intuitive relative to how a "scale" might be expected to work on darkness.
    • Irrad. Scale = 0.0: Produces the darkest possible AO shadows for the current Effect setting. Minimal ambient light penetrates the occluded areas.
    • Increasing Irrad. Scale (e.g., 0.5, 1.0, 2.5, 3.0...): Makes the AO shadows progressively lighter and less pronounced, eventually washing them out completely as more ambient light is "allowed" into the occluded regions.
  • Validation Method: Observing a sequence of images where only Irrad. Scale was incrementally increased, noting the clear, progressive lightening and reduction in intensity of the AO shadows.
  • Conclusion: Visual testing confirms this parameter also behaves counter-intuitively if one expects it to scale darkness. It appears to control how much of the original scene irradiance (ambient light) is mixed back into or allowed to illuminate the areas determined to be occluded. Low values result in less light mixing = darker shadows. High values result in more light mixing = lighter, fainter shadows.

2.8. Irrad. Max (Irradiance Max / Input Clamp)

  • UI Control: Slider/Spinner typically labeled "Irrad. Max".
  • Observed Behavior: Appears to clamp the maximum contribution of the scene's ambient light (irradiance) that is considered and fed into the AO modulation process. Its effect is most noticeable in scenes with very bright overall ambient lighting.
  • Validation Method: Primarily inferred from code structure and observing interactions with other intensity controls under varying global ambient light conditions (e.g., very bright vs. very dark Windlights).
  • Conclusion: Likely functions as an input clamp on the scene irradiance used by the SSAO calculation, interacting with the intensity logic of Effect and Irrad. Scale. It helps prevent overly bright ambient conditions from completely washing out the AO effect or causing unexpected intensity shifts.

3. System Interaction Summary (Based on Tested Reality)

The SSAO effect is generated and applied as follows, based on the observed behaviors:

  1. Enablement: RenderDeferredSSAO (the master checkbox) must be active.
  2. Occlusion Factor Calculation: For each pixel, an initial raw occlusion factor (ambocc) is calculated. This is based on depth samples taken from the G-Buffer within a screen-space radius.
    • The number of these depth samples is determined by Samples.
    • The base screen-space radius for these samples is determined by Scale (which is inversely scaled by distance to the point being shaded).
    • This effective radius is further clamped by Max Scale to prevent it from becoming too large for very close objects.
  3. Modulating Ambient Light for Final Composition: The calculated ambocc factor is then used to modulate how much the scene's ambient light contributes to the pixel's final color.
    • The scene's ambient light (irradiance) considered for modulation might first be clamped by Irrad. Max.
    • The primary darkness/strength of the AO shadow applied to this ambient light is dictated by the Effect setting (negative values increase darkness).
    • This darkness is then further lightened or made less intense by Irrad. Scale (lower Irrad. Scale values result in darker, more opaque AO shadows, while higher values make them lighter).
    • The Factor setting acts as an additional overall intensity multiplier on the resulting modulated ambient light, but very high values can introduce "bleeding" artifacts.
    • Finally, the viewer blends between the fully lit ambient color and this modulated (darkened) ambient color, using the ambocc factor as the blend weight. Where ambocc indicates high occlusion, more of the darkened ambient light is used.

4. Key Considerations & Trade-offs (Emphasizing Test Findings)

  • Primacy of In-Application Visual Testing: Understanding this SSAO system requires extensive in-application testing and observation. Settings like Effect and Irrad. Scale do not behave as simple positive multipliers based on code inspection alone; their visual output exhibits inverted or more complex relationships regarding perceived darkness/intensity. Similarly, artifacts like bleeding with high Factor values are only apparent through visual testing.
  • Distance-Dependent Artifacts & Quality: The optimal settings are highly dependent on the typical viewing distance of the subject or scene.
    • Close-Up Views (e.g., sub ~5 meters for portraits, detailed objects):
      • Require High Samples (e.g., 32, 64, or even 128+ on high-end systems) to minimize noise, patchiness, and flickering.
      • Banding artifacts (visible steps in smooth occluded gradients) can still occur even with high sample counts if the Scale is too large for the close proximity. Targeted reduction of Scale (e.g., to values between 100-300, or even lower in extreme cases) is often necessary to eliminate close-up banding, at the cost of a more localized and less broad AO effect.
    • Mid to Distant Views (e.g., landscapes, architectural overviews):
      • More tolerant of Lower Samples (e.g., 8-16), as noise and patchiness are less discernible from afar.
      • Can utilize Higher Scale values (e.g., 400-550+) to achieve softer, broader AO shadows that are visible on larger forms from a distance. However, these settings will likely produce significant visual artifacts (noise, banding, excessive blurriness) if the camera then moves in for a close-up view.
  • The "Perfect Universal Setting" Dilemma: Finding a single SSAO profile that looks optimal for all viewing distances and all scene types is extremely challenging, if not impossible, with the current parameter set. Users must typically prioritize their settings based on their primary use case (e.g., close-up photography vs. general exploration) or accept visual compromises in some situations.
  • Artifact Management (Key Test Findings):
    • Bleeding: Caused by excessively high Factor values (often in combination with high Scale), where AO darkening "leaks" onto distant, unrelated background surfaces. Must be managed by reducing Factor.
    • Banding: Stepped or contoured appearance in smooth occluded areas. Primarily mitigated by increasing Samples. For persistent close-up banding, reducing Scale is often the most effective solution.
    • Noise/Patchiness: Primarily mitigated by increasing Samples.
    • Excessive Blur/Haloing (Close-ups): Often due to a high Scale value for very near objects. Ensure Max Scale is appropriately set, and reduce Scale if necessary for close work.

5. Tiered Setting Recommendations (Based on Testing & Hardware)

These recommendations provide distinct starting points for optimizing SSAO towards either close-up quality or distant appearance, categorized by general hardware capabilities. These are derived from the in-application visual testing. Users should always fine-tune based on their specific preferences and observed performance.

Preamble: The Fundamental Trade-Off

SSAO settings involve a constant trade-off:

  • High Samples: Essential for smooth, artifact-free AO (less noise/banding), especially critical at close range, but are performance-intensive.
  • Sampling Radius (Scale, Max Scale): Determines the reach and sharpness of the AO.
    • Low/Moderate Scale: Better for realistic local detail (good for close-ups) and reduces the chance of banding. AO effect might appear subtle from afar.
    • High Scale: Creates softer, broader shadows visible from further away. Can introduce artifacts (banding, blurriness, bleeding) when viewed closely, especially with lower sample counts.
  • Intensity (Factor, Effect, Irrad. Scale): Needs careful tuning.
    • Remember Effect: Negative values = darker AO. 0.0 = AO off.
    • Remember Irrad. Scale: Lower values = darker AO. Higher values = lighter AO.
    • High Factor values were observed to cause "bleeding" artifacts.

The following profiles prioritize either close-up visual fidelity or mid/far distance visibility for different hardware tiers. No single profile will be perfect for both scenarios simultaneously.


Low-End System Recommendations (e.g., GTX 970 / 1060, or equivalent AMD)

Focus: Prioritizing playable framerates. Significant SSAO quality compromises are necessary.

1. Profile: Optimized for Close-Up Quality (Sub ~5m) * Samples: 16 (If absolutely necessary for FPS, fallback to 8, but expect severe artifacts like strong noise and patchiness). * Rationale: Minimum viable sample count to somewhat reduce the worst close-up noise and banding. * Scale: 100 - 200. * Rationale: Keeps the sampling radius tight to focus the limited samples locally and minimize banding/blurring artifacts that become very apparent with broader scales when viewed up close. * Max Scale: 200. * Factor: 1 - 3. * Rationale: Keep low to avoid exacerbating artifacts with few samples. * Effect: -0.8 to -1.0. * Irrad. Scale: 0.8 to 1.2. * (Other SSAO settings at their default values, or as per the current graphics preset). * Expected Result: The primary goal is maintaining playable FPS. AO will likely still be noticeably noisy and/or patchy up close, but strong banding artifacts caused by large scales should be reduced. The AO effect will be very localized and may diminish or disappear entirely from mid to far distances.

2. Profile: Optimized for Mid/Far Distance Appearance (> ~5m) * Samples: 8. * Rationale: Maximize performance; noise and patchiness from few samples are less obvious when viewed from a distance. * Scale: 300 - 450. * Rationale: Creates a broader AO effect necessary for it to be visible on larger forms from a distance. * Max Scale: 200. * Factor: 1. * Rationale: Minimize the risk of "bleeding" artifacts, which can be pronounced with a broad scale. * Effect: -0.8 to -1.0. * Irrad. Scale: 1.0 to 1.3. * Rationale: Ensure the broader AO effect remains visible and doesn't become too faint. * (Other SSAO settings at their default values, or as per the current graphics preset). * Expected Result: A soft AO effect should be visible on large forms and in general scene depth from mid to far distances. However, this profile will likely look very noisy, patchy, overly blurry, and potentially exhibit banding artifacts if the camera moves in for a close-up view.


Mid-Range System Recommendations (e.g., GTX 1070 / RTX 2060 / RX 5700, or equivalent AMD)

Focus: Achieving a good balance between SSAO visual quality and overall viewer performance. Can afford better quality for close-ups.

1. Profile: Optimized for Close-Up Quality (Sub ~5m) * Samples: 32 - 64. (64 is preferred if performance allows). * Rationale: Provides a good reduction in noise and banding artifacts for most close-up viewing scenarios. * Scale: 150 - 300. * Rationale: Offers a good balance for capturing local detail without excessive softness. If persistent banding occurs even at 64 samples, consider reducing Scale further towards 100 (or even slightly below as a targeted fix), accepting the tighter, more localized AO effect. * Max Scale: 200. * Factor: 1 - 5. * Rationale: Can handle slightly more intensity without severe artifacts, given the higher sample count. * Effect: -1.0. * Irrad. Scale: 1.0. * (Other SSAO settings at their default values, or as per the current graphics preset). * Expected Result: Good, relatively smooth AO for close-up views with minimal noise (especially noticeable at 64 samples). Banding should be unlikely but can be addressed by carefully reducing Scale if needed. The AO effect may become more subtle at far distances due to the moderate scale.

2. Profile: Optimized for Mid/Far Distance Appearance (> ~5m) * Samples: 16 - 32. (32 is better if performance allows). * Rationale: Balances performance with acceptable visual quality for distant AO. * Scale: 400 - 550. * Rationale: Achieves a visible softness and reach for the AO effect when viewed from afar. * Max Scale: 200. * Factor: 1 - 3. * Rationale: Keep modest with the larger scale to avoid bleeding. * Effect: -1.0. * Irrad. Scale: 1.0 to 1.3. * (Other SSAO settings at their default values, or as per the current graphics preset). * Expected Result: Clearly visible, soft AO enhancing depth from mid to far distances. When viewed up close, this profile will show some noise, more blurriness, and potentially some banding artifacts compared to the close-up optimized settings due to the lower sample count combined with a larger scale.


High-End System Recommendations (e.g., RTX 3080 / RX 6800XT and above)

Focus: Prioritizing maximum visual quality for SSAO. These systems can likely use settings that work reasonably well across various distances, but slight optimization for specific viewing priorities is still beneficial.

1. Profile: Optimized for Maximum Close-Up Quality (Sub ~5m) * Samples: 128 or higher (e.g., 256, if the UI and system support it without instability). * Rationale: Aims to virtually eliminate noise and banding for pristine, smooth AO in close-up shots. * Scale: 150 - 300. * Rationale: Focuses on high-fidelity local detail and contact shadows. If any subtle banding persists on extreme close inspection (unlikely with 128+ samples), Scale could be reduced further (towards 100), but this should rarely be necessary. * Max Scale: 200. * Factor: 1 - 5. * Rationale: Minimal risk of artifacts due to the high sample count. * Effect: -1.0 to -1.2. * Rationale: Creates a well-defined and noticeable AO effect. * Irrad. Scale: 1.0 to 1.2 (adjust in conjunction with Effect to fine-tune shadow depth). * (Other SSAO settings at their default values, or as per the current graphics preset). * Expected Result: Excellent, exceptionally smooth, and detailed AO for close-up views. This profile will likely look very good at medium distances as well, though the AO effect might appear more subtle at very far distances due to the moderate Scale.

2. Profile: Optimized for High-Quality Mid/Far Distance Appearance (> ~5m) / Best All-Rounder for High-End * Samples: 64 - 128 (128 is preferable if performance impact is acceptable). * Rationale: High sample counts ensure good quality and minimize artifacts even when using a slightly larger scale for better distant visibility. * Scale: 350 - 500. * Rationale: Provides a noticeable but still reasonably controlled soft AO effect from a distance, enhancing scene depth without excessive far-reaching bleed. * Max Scale: 200. * Factor: 1 - 5. * Effect: -1.0 to -1.2. * Irrad. Scale: 1.0 to 1.3. * (Other SSAO settings at their default values, or as per the current graphics preset). * Expected Result: Very good quality, smooth, soft AO visible from mid to far distances. The high sample count helps minimize artifacts even with the larger scale, meaning this profile will likely look quite good up close too, though perhaps slightly softer or less focused on micro-details compared to the dedicated close-up priority settings. This profile offers the best chance for a single setting configuration that works well across various viewing distances on high-end hardware.


Recommendation Summary: Users should select the profile for their hardware tier based on whether they primarily prioritize flawless close-up views (e.g., for portrait photography) or a consistently visible (though potentially less perfect up close) AO effect from further away (e.g., for general exploration or landscape shots). High-end system users have the least need to make significant compromises between these two priorities. Always test settings visually in your typical scenarios and monitor performance (FPS).


6. Testing Procedures for SSAO Validation

6.1. User-Level Visual Testing

  • Objective: To visually assess the impact of various SSAO parameter combinations on scene appearance, identify common visual artifacts (noise, banding, bleeding, excessive blur), and gauge the perceived impact on performance (FPS).
  • Methodology:
    1. Select diverse test scenes:
      • Interior rooms with sharp corners, crevices, and objects close to walls.
      • Exterior scenes with detailed clutter (e.g., foliage, rocks) and objects making contact with the ground.
      • Scenes with smooth, subtly curved surfaces where banding might be more apparent.
      • Scenes with high contrast lighting.
    2. Observe at different camera distances:
      • Close-up: Focus on a subject less than 5 meters away (e.g., an avatar for portraiture, a detailed prop).
      • Mid-range: View the scene from 5-15 meters.
      • Distant: Observe larger forms and overall scene depth from more than 15 meters.
    3. Systematically adjust individual SSAO parameters (Samples, Scale, Max Scale, Factor, Effect, Irrad. Scale) one at a time, while keeping others constant or at a known baseline.
    4. Note visual changes:
      • Darkness/Intensity: How prominent are the AO shadows?
      • Softness/Sharpness: Are the AO shadows crisp or diffuse?
      • Noise/Graininess: Is there a noticeable dither pattern or speckling?
      • Banding: Are there visible steps or contours in smooth occluded gradients?
      • Bleeding: Does AO darkening appear on unrelated distant surfaces?
      • Haloing/Over-blurring: Do objects appear to have an unrealistic dark halo or become overly blurred by the AO?
    5. Correlate visual changes with FPS impact.
    6. Pay specific attention to the counter-intuitive behaviors of Effect (negative values for darker AO) and Irrad. Scale (lower values for darker AO).
    7. Test the interaction of settings, e.g., high Samples with varying Scale, or high Factor with varying Scale.

6.2. Developer-Level Technical Testing (If Modifying Code)

  • Objective: To verify that the underlying implementation correctly translates UI settings into shader uniforms and produces the intended calculations, and to precisely measure performance impact.
  • Methodology:
    1. Verify Uniforms: Use a graphics debugger (e.g., RenderDoc, NVIDIA Nsight, AMD RGP) or in-code logging to confirm that values from the UI sliders/spinners for SSAO settings are correctly passed as uniforms to the relevant shaders (e.g., uniforms like ssao_effect_mat, ssao_irradiance_scale, ssao_factor, ssao_sample_count, uSSAOSampleRadiusSS, uSSAOMaxSampleRadiusSS in aoUtil.glsl or similar). Confirm if any inversion or complex mapping happens C++ side before being sent to the shader.
    2. Shader Debugging: If discrepancies exist between expected and observed behavior, step through the SSAO shaders (e.g., the main SSAO calculation pass shader, and where AO is applied in softenLightF.glsl or the main lighting composition shader).
      • Analyze the sample loop, how uSSAOSampleRadiusSS (derived from Scale and Max Scale) is used.
      • Understand how ssao_factor, ssao_effect_mat, and ssao_irradiance_scale modulate the final occlusion term or the ambient light.
      • Investigate the mix operation where the final ambocc factor blends between occluded and unoccluded ambient light.
    3. Performance Profiling:
      • Measure the GPU execution time specifically for the SSAO rendering pass(es) under varying Samples counts and other influential parameters.
      • Measure the full frame time impact (CPU and GPU) of enabling/disabling SSAO and when changing parameters known to affect performance.
    4. Artifact Analysis with Debugger:
      • For bleeding artifacts, use a graphics debugger to inspect pixel history and shader inputs for affected distant pixels. Determine if samples are being taken from too far away due to large Scale/Factor combinations, or if depth/normal data is being misinterpreted.
      • For banding artifacts, examine the sampling pattern and depth comparisons in the SSAO shader, especially for pixels in smooth gradient regions at close camera distances with specific Scale values. Check for precision issues or insufficient variation in sample distribution.

Concluding Remark: This document reflects the current understanding of the SSAO system's behavior, based rigorously on in-application visual testing and validation performed within Aperture Viewer. It provides empirically derived guidance for its effective use and optimization. Continuous refinement of these recommendations will occur as the viewer evolves and further testing is conducted.