# fudan-zvg/4d-gaussian-splatting architecture

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

- Interactive diagram: https://gitdiagram.com/fudan-zvg/4d-gaussian-splatting
- Repository: https://github.com/fudan-zvg/4d-gaussian-splatting

## Overview

##### Main Components
a. Input Processing Layer
b. Core Processing Pipeline
c. Rendering Layer
d. Output Generation Layer

##### Component Details

a. Input Processing Layer:
- Data input handlers for:
- DyNeRF dataset processing
- DNeRF dataset processing
- Camera parameters (scene/cameras.py)
- COLMAP data loading (scene/colmap_loader.py)

b. Core Processing Pipeline:
- Gaussian Model Processing:
- 4D Gaussian primitives handling (scene/gaussian_model.py)
- Point operations (pointops2/)
- Simple KNN operations (simple-knn/)

c. Rendering Layer:
- Differential Gaussian Rasterization:
- CUDA rasterizer (diff-gaussian-rasterization/)
- Gaussian renderer (gaussian_renderer/)

d. Output Generation Layer:
- Rendering output
- Loss computation (utils/loss_utils.py)
- Image processing (utils/image_utils.py)

##### Data Flow Indicators
- Raw data flow from input to processing
- Processing pipeline flow
- Rendering pipeline flow
- Output generation flow

##### Special Elements
- A CUDA/GPU acceleration indicator
- Parallel processing paths
- Real-time processing components
- Optimization loops

##### Implementation Details
- Utility modules:
- Camera utilities
- Graphics utilities
- System utilities
- Integration points with external libraries (GLM, CUDA)

##### The optimization and feedback loops

Use a hierarchical layout with:
- Top level: Major processing stages
- Second level: Individual components
- Third level: Implementation details
- Connecting lines: Data and control flow

This will create a clear visualization of how the system processes 4D Gaussian primitives to achieve real-time photorealistic dynamic scene representation and rendering.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style definitions
    classDef input fill:#a8d1f0,stroke:#000
    classDef processing fill:#90EE90,stroke:#000
    classDef rendering fill:#FFB347,stroke:#000
    classDef output fill:#DDA0DD,stroke:#000
    classDef cuda fill:#FF6B6B,stroke:#000
    classDef config fill:#E6E6FA,stroke:#000

    subgraph Input["Input Processing Layer"]
        DS["Dataset Processing"]
        CAM["Camera Parameters"]
        COL["COLMAP Loader"]
    end

    subgraph Core["Core Processing Pipeline"]
        GM["Gaussian Model"]
        PO["Point Operations"]
        KNN["KNN Operations"]
    end

    subgraph Render["Rendering Layer"]
        CR["CUDA Rasterizer"]
        GR["Gaussian Renderer"]
    end

    subgraph Output["Output Generation Layer"]
        LC["Loss Computation"]
        IP["Image Processing"]
        GU["Graphics Utilities"]
    end

    subgraph Utils["Utility Components"]
        CU["Camera Utilities"]
        SU["System Utilities"]
        GEN["General Utilities"]
    end

    subgraph Config["Configuration"]
        DN["DNeRF Configs"]
        DY["DyNeRF Configs"]
    end

    %% Connections
    DS --> GM
    CAM --> GM
    COL --> GM
    GM --> PO
    PO --> KNN
    KNN --> CR
    CR --> GR
    GR --> LC
    GR --> IP
    IP --> GU

    %% Utility connections
    CU --> CAM
    SU --> GM
    GEN --> PO
    DN --> DS
    DY --> DS

    %% Click events
    click DS "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/scene/dataset_readers.py"
    click CAM "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/scene/cameras.py"
    click COL "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/scene/colmap_loader.py"
    click GM "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/scene/gaussian_model.py"
    click PO "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/pointops2/functions/pointops.py"
    click KNN "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/simple-knn/simple_knn.cu"
    click CR "https://github.com/fudan-zvg/4d-gaussian-splatting/tree/main/diff-gaussian-rasterization/cuda_rasterizer"
    click GR "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/gaussian_renderer/diff_gaussian_rasterization.py"
    click LC "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/utils/loss_utils.py"
    click IP "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/utils/image_utils.py"
    click GU "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/utils/graphics_utils.py"
    click CU "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/utils/camera_utils.py"
    click SU "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/utils/system_utils.py"
    click GEN "https://github.com/fudan-zvg/4d-gaussian-splatting/blob/main/utils/general_utils.py"
    click DN "https://github.com/fudan-zvg/4d-gaussian-splatting/tree/main/configs/dnerf"
    click DY "https://github.com/fudan-zvg/4d-gaussian-splatting/tree/main/configs/dynerf"

    %% Style assignments
    class DS,CAM,COL input
    class GM,PO,KNN processing
    class CR,GR rendering
    class LC,IP,GU output
    class CU,SU,GEN processing
    class DN,DY config
```
