Computer Graphics II - Term Project - Vulpix

 Hi everyone! In this blog post, I will talk about my term project in CENG469 course, which is Vulkan based Ray Tracer, Vulpix. Inspired by the captivating Fire-type Pokemon of the same name. Vulpix combines the power of Vulkan and the art of ray tracing to bring you stunningly lifelike graphics. 

    Vulpix Ray Tracer - Crytek Sponza Scene

Firstly, I will give you brief information about the ray tracing pipeline, the acceleration structure, and the shader binding table. After that, I will show basic features of Vulpix shortly. Then, I will talk about the problems I faced and how I solved them.

Vulkan Ray Tracing Pipeline and Acceleration Structure

At the heart of my Vulkan-based ray tracer lies the VK_KHR_ray_tracing_pipeline extension. This powerful feature harnesses the GPU's capabilities to accelerate ray tracing, enabling us to achieve realistic visual effects. The ray tracing pipeline encompasses key stages, including ray generation, intersection testing, and shading. To optimize the ray tracing process, an acceleration structure, a bottom-level and top-level acceleration structure, is employed. These structures effectively organize scene geometry and allow for efficient ray-object intersection calculations.


Acceleration Structures of Vulkan


Ray Tracing Pipeline


Shader Binding Table: 

To bind shaders to the ray tracing pipeline, I utilized the shader binding table. This table maps shaders to specific ray tracing operations, facilitating efficient shader invocation during the rendering process. By carefully organizing shader bindings, I achieved optimal performance and reduced unnecessary computations, enhancing the overall efficiency of the ray tracer.




Some of Vulpix features as follows:

In the Vulpix, I implemented quaternion-based camera system. Unlike traditional camera systems that rely on Euler angles, which can encounter issues like gimbal lock and limitations in smooth rotations, a quaternion-based camera provides a seamless and intuitive way to navigate the scene. 

Besides, the Lambertian diffuse lighting model is implemented. Reflection, Refraction, and Shadows also supported.

Moreover, to streamline the process of importing 3D models into my ray tracer, I integrated the tinyobjloader library. This powerful library simplifies the task of loading OBJ models, a popular file format for representing 3D geometry.

Issues 

Building a ray tracer comes with its fair share of challenges. During my project, I encountered several issues, such as managing memory for large scenes, handling complex shader logic, and ensuring efficient ray-object intersection tests. To tackle these obstacles, I adopted various strategies, including memory optimization techniques, debugging and profiling tools (Nsight). 

And also, I had a hard time to get used to compile shader after I edit them. Unlikely, in OpenGL, we don't need to compile our shaders before running our program. I wasted most of my time to figure out where the problem is. Since I changed the shader code, I always kept asking myself why didn't have effect on the screen :)  Because I forgot to compile my shaders :| Thus, through diligent research, experimentation, I was able to overcome these challenges and continue progressing towards my goal.


My Scenes

I created my scenes by using Blender, and I get the models from this lovely website. I just import them in a Blender scene and export them as .obj file. Then, I import them in Vulpix.


Scene1: My custom scene with a ground plane, and lovely reflective teapot, and refractive bunny and Erato models

Scene1: Up View

Scene1: Close look


Scene2: This my custom Cryteck Sponza Scene, including reflective teapot and refractive Erato models 


Scene2: Close look to Erato

Short footage of Scene2


Another short footage of Scene2


Another short footage of Scene2


In my test system with AMD Ryzen 5800X CPU, Nvidia RTX 3070 GPU and 64GB RAM and MAX BOUNCE COUNT= 10, I get approximately 1100FPS in Scene1. However, If I get close to the objects, the FPS dropped ~400 FPS because of the path tracing. Similarly, Scene2, If I get close to the objects, the FPS dropped. Initially, I get 400FPS, when I close the object it dropped ~250FPS. However, there is no significant problem visually, Vulpix runs smoothly. 

Conclusion:

Since I couldn't do everything I wanted duration of the project (supporting gltf file format and Dear Imgui UI support) because of finals and other course assignments, building a Vulkan-based ray tracer for my computer graphics course has been a thrilling and rewarding experience. I will continue this project in my free time to see what's possible. I look forward to exploring further advancements in ray tracing and continuing to unleash the full potential of Vulkan in future projects.

References:

Acknowledgments:

Before we wrap up my post, I would like to point out couple of things. I made extensive use of iOrange’ Vulkan repository, as well as Vulkan Ray Tracing Tutorial repository from Nvidia. Without these resources, my project wouldn’t be possible. I would like to thank them.

I also would like to express my gratitude to the incredible community of writers, bloggers, and tutorial creators who have played an invaluable role in shaping my journey throughout this term project. Without their expertise, guidance, and wealth of knowledge shared on various blog and tutorial pages, I would not have been able to achieve the results.

In addition to the invaluable resources provided by the online community, I would like to extend my sincere appreciation to my professor and teaching assistant for their guidance and support throughout this semester. Their expertise, encouragement, and dedication to teaching have been instrumental in my understanding of computer graphics and the successful completion of my term project. I am truly grateful for their patience, insightful feedback, and commitment to cultivating a positive learning environment. Thank you to my professor and teaching assistant for their unwavering support and belief in my abilities.

Comments

Popular posts from this blog

Raven: The Beginning of My Ray Tracing Journey

Computer Graphics II - HW 2 - Dynamic Cube Mapping