- 操作系统:
Windows 10
- 编译器:
MSVC(Visual Studio 2019)
Opengl 3.3
以上CMake 3.18
以上
注: 不喜欢用CMake的同学可以通过CMake生成vs工程使用
本项目使用了一个简单的插件注册系统
-
打开
./code/components
文件夹 -
复制
RenderExample
文件夹, 并将其修改成你自己喜欢的名字 -
修改复制后的文件夹里的
CMakeLists.txt
文件... # 将"RenderExample"修改为你自己喜欢的名字, 千万不要和别的文件夹里的名字重复 set(MY_COMPONENT_NAME "RenderExample") ...
-
修改
./code/components/CMakeLists.txt
... # 添加 add_subdirectory("./我的文件夹")
-
继承类
NRenderer::RenderComponent
, 并且重写void render(...)
函数// 详情请看RenderExample示例 class Adapter : public NRenderer::RenderComponent { virtual void render(NRenderer::SharedScene spScene) { .... } };
-
注册插件
+ 参数1 -> 插件名称,不要写中文 + 参数2 -> 插件的描述 + 参数3 -> 注册的类, 类的名字 REGISTER_RENDERER(Render, RenderTest, A);
-
重新生成CMake缓存并且重新编译插件
向场景中投射光线, 计算直接光照. 计算方法为(Phong, 忽略了环境光) $$ L_o = k_d\cdot Li + k_s\cdot Li(V \cdot R)^p $$
场景文件为 ray_cast_cornel.scn
使用Monte Carlo方法计算光照, 不支持网格, 仅支持漫反射材质
场景文件path_tracing_cornel.scn
导体材质,即金属,具有镜面反射效果。
$$
f_{BRDF}(x, w_i, w_o) = F_r(w_r)\frac{\delta(w_i-w_r)}{cos \theta_i} \
$$
-
$w_r$ 为反射光线 -
$F_r(w_r)$ 为菲涅尔项
绝缘体,例如玻璃
代码说明(intro.md)# nrenderer