Skip to content

Zhytou/SimplePathTracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

296 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Path Tracer

A modern, lightweight, physically based CPU Path Tracer built with C++20.

wakatime

📸 Showcases

Diffuse Cuboid Glossy Cuboid Metal Cuboid
cuboid glossy-cuboid metal-cuboid
Diffuse Sphere Glossy Sphere Metal Sphere Glass Sphere
sphere glossy-sphere metal-sphere glass-sphere

More Examples:

dragon

veach-mis

staircase

✨ Main Features

  • 💎 微表面物理材质模型 (PBR Microfacet Material)
    • 基于 Cook-Torrance BRDF,完整包含 GGX (Trowbridge-Reitz) 法线分布函数与 Smith-GGX 几何遮蔽/阴影函数。
    • 支持 Diffuse(漫反射)Glossy(光泽反射)Specular(纯镜面)Glass/Transmission(玻璃透射与全内反射 TIR)
  • 🎲 重要性采样与数值收敛 (Importance Sampling & MIS)
    • GGX 半角向量采样:针对 Glossy 粗糙表面进行高效高光采样,大幅降低微表面高光噪点。
    • Cosine-Weighted 半球采样:针对 Diffuse 表面进行标准 Cosine 权重采样。
    • 显式光源采样 (Next Event Estimation, NEE)多重重要性采样 (MIS):混合光源采样与 BSDF 采样,完美解决 Veach-MIS 等经典强对比光源场景。
  • 现代 C++20 架构与基础设施
    • 自研极简向量数学库 (Vec):提供高效的三维/二维向量加减、点乘、叉乘、归一化、插值与随机生成接口,零冗余依赖。
    • Fluent BoxLogger:自研轻量级流式格式化日志库,支持 C++ 流式调用 (<<)、自动化控制台/文件排版输出以及 Debug 源码位置追踪 (__FILE__, __LINE__)。

Build & Run

# 克隆项目
git clone git@github.com:Zhytou/SimplePathTracer.git

# 下载第三方库
git submodule update --init

# 使用CMake编译
mkdir build
cd build
cmake ../

# 运行路径追踪渲染程序
make tracer
./tracer

About

A simple c++ realistic rendering engine using Monte Carlo Path Tracing

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages