# ddgi **Repository Path**: xdray/ddgi ## Basic Information - **Project Name**: ddgi - **Description**: DDGI GI算法demo实现,使用Vulkan API - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-16 - **Last Updated**: 2026-07-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DDGI DDGI(Dynamic Diffuse Global Illumination)算法的简单实现。在场景中撒一张 3D 探针网格,每个探针记录周围各方向的辐照度与距离,着色时对相邻 8 个探针做三线性插值并用距离场做可见性测试,得到实时动态的 diffuse 全局光照。 ![preview](images/preview.png) ## 技术栈 - **Vulkan** + **C++17** - **CMake** + **Ninja** 构建 - **GLSL** shader,通过 glslangValidator 编进 SPIR-V - 光线追踪走 `GL_EXT_ray_query` - 第三方:glfw、glm、VulkanMemoryAllocator、imgui、stb_image ## 主要特性 - 3D 探针网格 + 八面体(octahedral)贴图编码 - Fibonacci 球面射线分布 + 每探针/每帧旋转 - 余弦加权辐照度 gather、距离场 E[D]/E[D²] - Chebyshev / VSM 可见性测试 - 三线性探针插值 + 法线权重 - EMA 时域累积 + 亮度钳制 - 多 bounce:历史辐照度反馈 - ACES filmic tonemap - 可选 SSAO(半分辨率 + 双边模糊) - ImGui 运行时调参面板 ## 构建 ```sh cmake -B build -G Ninja ninja -C build ``` shader 已集成进 CMake,`ninja` 命令会同时编译 C++ 和 GLSL。 ## 运行 ```sh ./build/ddgi_demo ``` ## 项目结构 ``` src/ C++ 源码(main / demo / scene) shaders/ GLSL shader(compute / vert / frag) shaders/common/ 共享头:common.glsl、rotation.glsl、sh_sample.glsl 3rd/ 第三方库 vx/ 自用 Vulkan 辅助库(含 ImGui 集成) assets/ 资源(构建时拷贝到输出目录) images/ 截图 ```