# ocasm/ssms architecture

> Architecture diagram of the GitHub repository ocasm/ssms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ocasm/ssms
- Repository: https://github.com/ocasm/ssms

## Overview

##### Main Components

A. Input Layer
- Camera/Scene Render
- Original Frame Buffer

B. Post-Processing Pipeline
- SSMS Effect Component
- Global Fog Component
- Shader Processing Units

C. Rendering Components
- SSMS Shader System
- Global Fog Shader System
- Texture Resources

##### Component Relationships

**[Scene Camera] → [Frame Buffer]**
- ↓
**[SSMS Component (SSMS.cs)]**
- ↓
**[Shader Processing]**
- [SSMS.shader]
- [SSMS.cginc]
- [SSMSGlobalFog.shader]
- ↓
**[Final Rendered Output]**

##### Key Elements to Highlight

- The relationship between SSMS.cs and its shader implementations
- The integration with Unity's rendering pipeline
- The optional nature of the Global Fog effect
- The texture resource utilization
- The post-processing order (original → fog → SSMS → final output)

##### Technical Details

- Input: Scene render texture
- Processing: Multiple scattering computation
- Output: Modified frame buffer with enhanced atmospheric effects
- Configuration: Material parameters and fog settings

##### Implementation Notes

- Inheritance from Unity's post-processing framework
- Shader pass sequence
- Integration points with Unity's rendering pipeline
- Configuration flow from components to shaders

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        Camera["Scene Camera"]
        FrameBuffer[("Frame Buffer")]:::data
    end

    subgraph "Post-Processing Pipeline"
        SSMS["SSMS Component"]:::component
        GlobalFog["Global Fog Component"]:::component
    end

    subgraph "Shader System"
        SSMSShader["SSMS Shader"]:::shader
        SSMSInclude["SSMS Include File"]:::shader
        FogShader["Global Fog Shader"]:::shader
    end

    subgraph Resources
        TextureRes[("Texture Resources")]:::data
        ExampleScene["Example Scene"]:::example
        ExampleMat["Example Material"]:::example
        Package["SSMS Package"]:::dist
    end

    %% Connections
    Camera --> FrameBuffer
    FrameBuffer --> SSMS
    FrameBuffer -.-> GlobalFog
    GlobalFog --> SSMS
    SSMS --> FinalOutput["Final Rendered Output"]:::output

    %% Shader Connections
    SSMS --> SSMSShader
    SSMSShader --> SSMSInclude
    GlobalFog --> FogShader
    TextureRes --> SSMSShader
    TextureRes --> FogShader

    %% Click Events
    click SSMS "https://github.com/OCASM/SSMS/blob/master/SSMS.cs"
    click GlobalFog "https://github.com/OCASM/SSMS/blob/master/SSMSGlobalFog.cs"
    click SSMSShader "https://github.com/OCASM/SSMS/blob/master/Resources/Shaders/SSMS.shader"
    click SSMSInclude "https://github.com/OCASM/SSMS/blob/master/Resources/Shaders/SSMS.cginc"
    click FogShader "https://github.com/OCASM/SSMS/blob/master/Resources/Shaders/SSMSGlobalFog.shader"
    click TextureRes "https://github.com/OCASM/SSMS/tree/master/Resources/Textures/"
    click ExampleScene "https://github.com/OCASM/SSMS/blob/master/Example/ssms_example.unity"
    click ExampleMat "https://github.com/OCASM/SSMS/blob/master/Example/ssms_000.mat"
    click Package "https://github.com/OCASM/SSMS/blob/master/SSMS.unitypackage"

    %% Styling
    classDef component fill:#90EE90,stroke:#333,stroke-width:2px
    classDef shader fill:#FFA500,stroke:#333,stroke-width:2px
    classDef data fill:#B0C4DE,stroke:#333,stroke-width:2px
    classDef output fill:#98FB98,stroke:#333,stroke-width:2px
    classDef example fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef dist fill:#FFB6C1,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Processing Component"]:::component
        L2["Shader Resource"]:::shader
        L3[("Data Storage")]:::data
        L4["Example Resources"]:::example
        L5["Distribution"]:::dist
    end
```
