Skip to main content

polyscope_core/
ssao.rs

1//! SSAO (Screen Space Ambient Occlusion) configuration.
2
3use serde::{Deserialize, Serialize};
4
5/// SSAO configuration.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct SsaoConfig {
8    /// Whether SSAO is enabled.
9    pub enabled: bool,
10    /// Sample radius in world units (relative to length scale).
11    pub radius: f32,
12    /// Intensity/strength of the effect (0.0 = none, 1.0 = full).
13    pub intensity: f32,
14    /// Bias to prevent self-occlusion artifacts.
15    pub bias: f32,
16    /// Number of samples per pixel (higher = better quality, slower).
17    pub sample_count: u32,
18}
19
20impl Default for SsaoConfig {
21    fn default() -> Self {
22        Self {
23            enabled: false,
24            radius: 0.5,      // Good balance for most scenes
25            intensity: 1.5,   // Slightly stronger than linear for visible effect
26            bias: 0.025,      // Small bias to prevent self-occlusion
27            sample_count: 16, // Good quality/performance balance
28        }
29    }
30}