Hello everyone and welcome to the sixth and final blog of my
ray tracing journey! In this assignment, I have implemented BRDFs, Object Light
and Path Tracing features in Raven. While I titled this blogpost with “Closing
the Ray Tracing Journey”, it actually marks the beginning of my exploration
into Path Tracing world. I look forward to dedicating my time to learning more
about this exciting world.
 |
Sponza Scene with 100 samples rendered in 24 min
|
1. BRDFs
BRDFs (Bidirectional Reflectance Distribution Functions)
determine how much light is reflected from a surface based on the angles of
incoming and outgoing light. They are essential for calculating diffuse and
specular shading at a specific point on the surface. Until now, we have only used
the Blinn-Phong shading model. With this assignment, the following types of
BRDFs will be supported:
- Phong
- Modified Phong
- Normalized Modified Phong
- Blinn-Phong
- Modified Blinn-Phong
- Normalized Modified Blinn-Phong
- Torrance-Sparrow
 |
BRDF Phong Original |
 |
BRDF Modifed Phong |
 |
BRDF Phong Modifed Normalized |
 |
Blinn-Phong Original |
 |
Blinn-Phong Modifed |
 |
Blinn-Phong Modified Normalized |
 |
Torrance-Sparrow |
2. Object Lights
Raven previously supported only lights that were not visible
in the scene, such as PointLight and AreaLight. At that time, no ray
intersection tests were conducted for these light objects. In this assignment,
we have introduced two types of object lights: LightMesh and LightSphere. These
new lights not only provide illumination for the scene but are also treated as
objects within the BVH. This allows them to be tested for intersections with
the rays that are sent out.
For the object lights, I used multiple
inheritance. The MeshLight class inherits from both the Light and Mesh classes,
while the SphereLight class inherits from both the Light and Sphere classes.
Additionally, these classes contain a property that specifies the radiance of
the light object, which is defined in the XML.
 |
Cornellbox Jaroslav Diffuse Scene |
 |
Cornellbox Jaroslav Diffuse Area Scene
|
 |
Cornellbox Jaroslav Glossy Scene
|
 |
Cornellbox Jaroslav Glossy Area Scene
|
 |
Cornellbox Jaroslav Glossy Area Ellipsoid Scene
|
 |
Cornellbox Jaroslav Glossy Area Small Scene |
 |
Cornellbox Jaroslav Glossy Area Sphere Scene
|
3. Path Tracing
Finally, Raven can support for the Path Tracing.
Previously, illumination calculations were limited to direct lighting only.
Now, indirect lighting also plays a role in determining the final color of each
pixel.
We have introduced two new elements in the XML input files: Renderer
and RendererParams. These elements specify whether rendering will
use Ray Tracing or Path Tracing. The RendererParams can include options such as NextEventEstimation,
RussianRoulette, and ImportanceSampling, indicating which specific algorithms
will be used when the Renderer type is set to Path Tracing.
- ImportanceSampling: With this option, directions are sampled
over the hemisphere in a way that is denser near the surface normal, rather
than uniformly. This improves the accuracy and quality of the rendered image.
- NextEventEstimation: This option allows the contribution
from direct lighting to be included alongside indirect lighting.
- RussianRoulette: This algorithm allows for the termination
of rays based on the Russian Roulette method, rather than stopping them after
reaching a fixed recursion depth. This approach helps reduce bias in the
rendering results.
These improvements greatly enhance Raven’s capabilities by
integrating BRDFs, Object Lights and Path Tracing features, enabling more
realistic and visually stunning results.
 |
Sponza with RayTracing
|
 |
Sponza with Path Tracing
|
 |
Glass Importance Nee Weighted Revised Prism Light Scene with 400 samples
|
 |
Glass Importance Nee Weighted Revised Flat Light Scene with 400 samples |
 |
Diffuse Importance Nee with Sphere Light with 100 samples
|
 |
Diffuse Importance Nee with Flat Light with 100 samples |
 |
Diffuse Importance Nee with Prism Light with 100 samples
|
 |
Diffuse Russian Roulette with Prism Light with 100 samples |
Issues
Here's some of the issues that I faced during the implementation.
At one point, I miscalculated the pos
value due to misplaced parentheses. Specifically, I incorrectly computed random_v
with v1
without subtracting 1.0f. After identifying the issue, I corrected the calculation and resolved the problem.
 |
Sampling Problem in Sphere Light |
 |
It reminds me Daft Punk Helmets 😂 |
Notes:
I haven't had enough time to implement Splitting due to my
hectic schedule, even tough it is not hard to implement. However, I plan to work on it when I find a suitable moment.
I'm eager to dedicate my time to learning more about the exciting world of Path
Tracing.
For the Glass Scene, I couldn't achive a caustic effect as good as example output. I plan to dedicate time to identifying and resolving the
cause of the issue.
Comments
Post a Comment