Skip to content

AKGWSB/EzRT

Repository files navigation

EzRT

Easy Raytracing Tutorial (EzRT) is a lite code, simple tutorial for beginners to learn raytracing, with OpenGL and C++

OverView

This tutorial contains 5 chapters, each chapter include tutorial blog (provide .md & .pdf files) and example code.

part 1. basic ray tracing

In this part we will implement a basic ray tracing program with C++, then output each pixel as the result to png image.

part 2. BVH Accelerate Struct

We just using a for loop to travel meshes. But BVH will support us to tracing on a big mesh with lots of triangles, and accelerate the program.

part 3. OpenGL ray tracing

Using OpenGL's fragment shader to run accelerate program. Transfer BVH and triangles in texture buffer, then send to shader. Finally tracing each pixel progressively, then display the dynamic tracing process in screen.

part 4. disney principle's BRDF

Learning micro facet theory, using Disney principle's BRDF to rendering various of physical material.

image-20211023170631173

part 5. Importance Sampling & Low Discrepancy Sequence

Methods to denoise, accelerate fitting progress.

Low Discrepancy Sequence (Sobol) :

Importance Sampling, diffuse (left) and BRDF (right) :

Importance Sampling for HDR envmap :

Multi Importance Sampling with Heuristic power :

Requirement

environment:

  • Windows 10 x64
  • visual studio 2019
  • vcpkg
  • cmake

C++ lib:

  • GLUT (freeglut) >= 3.0.0
  • GLEW >= 2.1.0
  • GLM >= 0.9.9.5

Third part cpp lib:

  • hdrloader

Build

cd to source coce directory, then:

cmake ./

Other

  • building on x64
  • set project 'main' as 启动项目
  • running in Release mode

Bugs & TODO

  • fix error in chapter 1, it's right to multiply cosine wo in rendering equation, not wi
  • 摆烂了

Reference

[1] Brent Burley, Walt Disney Animation Studios 2012, "Physically-Based Shading at Disney"

[2] Stephen Joe and Frances Kuo, "Sobol sequence generator"

[3] Stephen Joe and Frances Y. Kuo, "Notes on generating Sobol sequences"

[4] cs184.eecs.berkeley.edu, "Project 3-2, Part 3: Environment Map Lights"

[5] blender (document), "Cycles Sampling Patterns, Sobol"

[6] Shih-Chin, "Implementing Disney Principled BRDF in Arnold"

[7] Matt Pharr, Wenzel Jakob, and Greg Humphreys, "Physically Based Rendering: From Theory To Implementation"

[8] knightcrawler25 (GitHub), "GLSL-PathTracer"

[9] 文刀秋二 (知乎), "低差异序列(一)- 常见序列的定义及性质"

[10] ksg fk (知乎), "【Nori】任务5:路径追踪,微表面模型和多重重要性采样"

[11] Image Synthesis (CS474 F16), "Assignment 4 -- Image-based Lighting"

[12] Dezeming (CSDN), "多重重要性采样(MIS)与光线追踪技术"

[13] lookof (博客园), "BVH with SAH (Bounding Volume Hierarchy with Surface Area Heuristic)"

[14] bluerose (知乎), "PBRT笔记(12)——蒙特卡洛积分"

[15] 孙小磊 (知乎), "计算机图形学十五:全局光照(蒙特卡洛路径追踪)"

[16] Atrix256 (twitter), "Casual Shadertoy Path Tracing"