当前位置:网站首页>Project training of Software College of Shandong University rendering engine system basic renderer (IV)

Project training of Software College of Shandong University rendering engine system basic renderer (IV)

2022-06-12 15:51:00 chenxiang_ two hundred thousand one hundred and eight

< Project training of Software College of Shandong University > Rendering engine system —— Base renderer ( Four )

Preface

This project hopes to implement a basic renderer , At the same time, it can support the use of precomputing . This article focuses on PathTracer Specific code .
Project address

One 、 Basic logic

Based on the idea of basic path tracking : To calculate the contribution of the path corresponding to each pixel , We first initialize the path . Depending on the corresponding pixel from VBuffer After reading the hit point information in , For this hit point , We first calculate the contribution of direct illumination . Because we support multiple importance sampling , So we need to sample the light source when calculating the direct illumination contribution , For different light sources , We distinguish between different ways of calculating contributions , This contribution is then superimposed on this ray result . Of course , If the sampled light source does not actually contribute to the hit point , Then we will ignore it .

After calculating the contribution of direct illumination , We generate and track scattered rays , The direction of the light is determined by BRDF Sampling acquisition of . For tracking the hit results , We saved it . If we don't hit the object in the scene , Then we sample the ambient light directly and add its contribution to the path . If we hit , Then update the current path throughput, After that, take the new hit point as the starting point to continue the tracking similar to the above .

Two 、 Main function code

1、 Define resources in the header file

H_FILE

2、Pass Structure and resources

This part is related to VBuffer similar , Quantity only 、 And so on , No more specific display code .

3、Shader Track the path within

pathTrace

summary

It mainly shows PathTracer The main code of function realization , However, there is no specific path tracking implementation code , The specific path tracking process will be shown later .

原网站

版权声明
本文为[chenxiang_ two hundred thousand one hundred and eight]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121545121641.html