- 扩展Material类,添加PBR纹理槽(Albedo/Normal/Metallic/Roughness/AO/Emission) - 添加Mesh::compute_tangents()方法用于法线贴图计算 - 扩展RayTracer材质上传,支持纹理句柄传递 - 更新raytracing compute shader,添加PBR纹理采样和法线贴图TBN变换 - 修复GLSL/C++结构体内存对齐问题 - 添加ACES色调映射解决自发光过曝问题 - 修复累积缓冲区应在色调映射前存储HDR值 - 修复G-Buffer材质类型未传递给光线追踪的问题 - 添加玻璃材质折射逻辑(折射比例、法线翻转、全内反射) - Cornell Box示例添加玻璃球(折射)、发光球(自发光)和金属球测试 |
||
|---|---|---|
| examples | ||
| include | ||
| lib | ||
| res/logo | ||
| scripts | ||
| shaders | ||
| src | ||
| .gitignore | ||
| AGENTS.md | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
| README_zh.md | ||
README.md
Overview
Aurora Rendering Engine (ARE) is a high-performance path tracing library developed in C++ by NanoEra Studio.
Dependencies
- OpenGL 4.3
- GLFW
- GLAD
- GLM
- stb-image
- spdlog
Quick Start
Clone Repository
git clone https://github.com/NanoEra/aurora-rendering-engine.git
cd aurora-rendering-engine
Build Project
mkdir build && cd build
cmake ..
cmake --build .
Example
Here is a cornell box demo using ARE:
#include <core/renderer.h>
#include <scene/scene.h>
#include <scene/camera.h>
#include <scene/mesh.h>
#include <scene/material.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
using namespace are;
int main() {
// 1. Initialize window
glfwInit();
GLFWwindow* window = glfwCreateWindow(800, 800, "Aurora - Cornell Box", nullptr, nullptr);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
// 2. Configure renderer
RendererConfig config;
config.width_ = 800;
config.height_ = 800;
config.samples_per_pixel_ = 1;
config.max_ray_depth_ = 4;
auto renderer = std::make_unique<Renderer>(config);
renderer->initialize();
// 3. Create scene
auto scene = std::make_unique<Scene>();
// Create materials
auto white_mat = std::make_shared<Material>();
white_mat->set_albedo(Vec3(0.73f, 0.73f, 0.73f));
white_mat->set_type(MaterialType::DIFFUSE);
uint white_id = scene->add_material(white_mat);
auto red_mat = std::make_shared<Material>();
red_mat->set_albedo(Vec3(0.65f, 0.05f, 0.05f));
red_mat->set_type(MaterialType::DIFFUSE);
uint red_id = scene->add_material(red_mat);
// Create floor mesh (example: a simple quad)
auto floor = std::make_shared<Mesh>();
std::vector<Vertex> vertices = {
{{-2.0f, -2.0f, -2.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f}, {1.0f, 0.0f, 0.0f}},
{{ 2.0f, -2.0f, -2.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 0.0f, 0.0f}},
{{ 2.0f, -2.0f, 2.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}, {1.0f, 0.0f, 0.0f}},
{{-2.0f, -2.0f, 2.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 0.0f, 0.0f}}
};
std::vector<uint> indices = {0, 1, 2, 0, 2, 3};
floor->set_vertices(vertices);
floor->set_indices(indices);
floor->set_material(white_id);
floor->upload_to_gpu();
scene->add_mesh(floor);
// Setup camera
auto camera = std::make_shared<Camera>();
camera->set_position(Vec3(0.0f, 0.0f, 4.5f));
camera->set_target(Vec3(0.0f, 0.0f, 0.0f));
camera->set_perspective(45.0f, 1.0f, 0.1f, 100.0f);
scene->set_camera(camera);
// 4. Render loop
while (!glfwWindowShouldClose(window)) {
renderer->render(*scene);
glfwSwapBuffers(window);
glfwPollEvents();
}
return 0;
}
Built by NanoEra Studio