Reader small image

You're reading from  The Modern Vulkan Cookbook

Product typeBook
Published inApr 2024
Reading LevelN/a
PublisherPackt
ISBN-139781803239989
Edition1st Edition
Languages
Concepts
Right arrow
Authors (2):
Preetish Kakkar
Preetish Kakkar
author image
Preetish Kakkar

Preetish Kakkar is a senior computer graphics engineer with Adobe and works on the rendering engine that powers products such as Aero, Stager, and After Effects. He has worked at Microsoft, MathWorks, and Stryker, where he co-authored various rendering engines as well as using other engines such as Unreal and Unity. He has more than 15 years of software development experience along with 10+ years in 3D graphics, scientific visualization, and medical imaging.
Read more about Preetish Kakkar

Mauricio Maurer
Mauricio Maurer
author image
Mauricio Maurer

Mauricio Maurer is a computer graphics engineer with nearly 20 years of experience working with 2D and 3D rendering, computational geometry, and rasterization in the fields of scientific visualization, CAD/CAM, and social networking. He is currently a graphics software engineer at Meta, helping to develop the next generation of AR/VR devices. Mauricio holds two master's degrees in computer science with a specialization in computer graphics from SUNY Stony Brook, NY, and the Federal University of Parana, Brazil.
Read more about Mauricio Maurer

View More author details
Right arrow

Ray Tracing and Hybrid Rendering

In this chapter, we venture into the fascinating world of ray tracing and hybrid rendering. Ray tracing, to put it simply, is a special technique used in computer graphics that simulates how light interacts with objects. This results in images that are so lifelike, they can be mistaken for reality. However, pure ray tracing is computationally intensive and requires significant hardware resources, which makes it unfeasible for real-time applications with the current generation of hardware. On the other hand, there’s hybrid rendering, which is a mix of conventional rasterization techniques and the realism of ray tracing. This blend offers both good performance and stunning visuals. This chapter will take you through how these techniques can be implemented using Vulkan. We’ll show you how to set up a ray tracing pipeline and guide you on how to integrate hybrid rendering into your work. By the end of this chapter, you will have a deeper understanding...

Technical requirements

For this chapter, you will need to make sure you have Visual Studio 2022 installed along with the Vulkan SDK. Basic familiarity with the C++ programming language and an understanding of ray tracing concepts would be useful. Please revisit Chapter 1, Vulkan Core Concepts, for details about setting up and building the code in the repository. We also assume that by now you are familiar with the Vulkan API and various concepts that were introduced in previous chapters. This chapter has multiple recipes, which can be launched using the following executables:

  1. Chapter07_RayTracer.exe
  2. Chapter07_HybridRenderer.exe

The code files for this chapter can be found here: https://github.com/PacktPublishing/The-Modern-Vulkan-Cookbook.

Implementing a GPU ray tracer

Ray tracing is a rendering technique that simulates the physical behavior of light to generate highly realistic graphics. Ray tracing works by tracing the path of light from a pixel in the image sensor back to its source. Each ray of light can interact with the objects in the scene, causing a variety of effects such as reflection, refraction, or absorption. This allows for the creation of realistic shadows, reflections, and light dispersion effects in complex 3D scenes. In previous chapters, specifically Chapter 4, Exploring Techniques for Lighting, Shading, and Shadows, we explored rasterization. It takes a more direct approach, converting 3D polygons that make up a scene directly into a 2D image. It essentially fills in the pixels of each polygon based on its color and texture. On the other hand, ray tracing simulates the path of light rays from the camera to the scene, accounting for how these rays interact with the scene’s objects.

Before...

Implementing hybrid rendering

In this recipe, we will explore the integration of rasterization, specifically deferred rendering, with ray-traced shadows.

In Chapter 4, Exploring Techniques for Lighting, Shading, and Shadows, we implemented deferred rendering, incorporating techniques such as shadow mapping, screen space AO, and screen space reflections. These techniques allowed us to generate multiple textures, which were then composited during the lighting pass. Within this recipe, you will gain insights into generating shadow textures using ray tracing, which will help in overcoming challenges associated with techniques such as screen space shadow mapping. Screen space shadow mapping relies on the information available in the rendered image. It doesn’t have complete access to the entire 3D scene geometry. This limitation can result in inaccuracies and artifacts. Screen space shadow mapping is susceptible to aliasing issues, particularly along edges and boundaries due to...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
The Modern Vulkan Cookbook
Published in: Apr 2024Publisher: PacktISBN-13: 9781803239989
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Preetish Kakkar

Preetish Kakkar is a senior computer graphics engineer with Adobe and works on the rendering engine that powers products such as Aero, Stager, and After Effects. He has worked at Microsoft, MathWorks, and Stryker, where he co-authored various rendering engines as well as using other engines such as Unreal and Unity. He has more than 15 years of software development experience along with 10+ years in 3D graphics, scientific visualization, and medical imaging.
Read more about Preetish Kakkar

author image
Mauricio Maurer

Mauricio Maurer is a computer graphics engineer with nearly 20 years of experience working with 2D and 3D rendering, computational geometry, and rasterization in the fields of scientific visualization, CAD/CAM, and social networking. He is currently a graphics software engineer at Meta, helping to develop the next generation of AR/VR devices. Mauricio holds two master's degrees in computer science with a specialization in computer graphics from SUNY Stony Brook, NY, and the Federal University of Parana, Brazil.
Read more about Mauricio Maurer