Mastering Graphics Programming with Vulkan: Develop a modern rendering engine from first principles to state-of-the-art techniques

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Develop a rendering framework by implementing next-generation 3D graphics, leveraging advanced Vulkan features, and getting familiar with efficient real-time ray tracing techniques uncovered by leading industry experts

Key Features

  • Develop high-performance rendering techniques in Vulkan
  • Automate some of the more tedious aspects like pipeline layouts and resource barriers
  • Understand how to take advantage of mesh shaders and ray tracing

Book Description

Vulkan is now an established and flexible multi-platform graphics API. It has been adopted in many industries, including game development, medical imaging, movie productions, and media playback. Learning Vulkan is a foundational step to understanding how a modern graphics API works, both on desktop and mobile.

In Mastering Graphics Programming with Vulkan, you'll begin by developing the foundations of a rendering framework. You'll learn how to leverage advanced Vulkan features to write a modern rendering engine. The chapters will cover how to automate resource binding and dependencies. You'll then take advantage of GPU-driven rendering to scale the size of your scenes and finally, you'll get familiar with ray tracing techniques that will improve the visual quality of your rendered image.

By the end of this book, you'll have a thorough understanding of the inner workings of a modern rendering engine and the graphics techniques employed to achieve state-of-the-art results. The framework developed in this book will be the starting point for all your future experiments.

What you will learn

  • Understand resources management and modern bindless techniques
  • Get comfortable with how a frame graph works and know its advantages
  • Explore how to render efficiently with many light sources
  • Discover how to integrate variable rate shading
  • Understand the benefits and limitations of temporal anti-aliasing
  • Get to grips with how GPU-driven rendering works
  • Explore and leverage ray tracing to improve render quality

Who this book is for

This book is for professional graphics and game developers who want to gain in-depth knowledge about how to write a modern and performant rendering engine in Vulkan. Familiarity with basic concepts of graphics programming (i.e. matrices, vectors, etc.) and fundamental knowledge of Vulkan are required.

Table of Contents

  1. Introducing the Raptor Engine and Hydra
  2. Improving Resources Management
  3. Unlocking Multi-Threading
  4. Implementing a Frame Graph
  5. Unlocking Async Compute
  6. GPU-Driven Rendering
  7. Rendering Many Lights with Clustered Deferred Rendering
  8. Adding Shadows Using Mesh Shaders
  9. Implementing Variable Rate Shading
  10. Adding Volumetric Fog
  11. Temporal Anti-Aliasing
  12. Getting Started with Ray Tracing
  13. Revisiting Shadows with Ray Tracing
  14. Adding Dynamic Diffuse Global Illumination with Ray Tracing
  15. Adding Reflections with Ray Tracing

Author(s): Marco Castorina, Gabriel Sassone
Edition: 1
Publisher: Packt Publishing
Year: 2023

Language: English
Pages: 382
City: Birmingham
Tags: 3D Graphics; Rendering Framework; Vulkan; Real-Time Ray Tracing; Pipeline Layouts; Mesh Shaders; Graphics API; Rendering Engine; GPU; Graphics Programming; Multi-Threading

Cover
Title Page
Copyright and Credits
Acknowledgments
Contributors
Table of Contents
Preface
Part 1: Foundations of a Modern Rendering Engine
Chapter 1: Introducing the Raptor Engine and Hydra
Technical requirements
Windows
Linux
macOS
How to read this book
Understanding the code structure
Layers of code
Understanding the glTF scene format
PBR in a nutshell
A word on GPU debugging
Summary
Further reading
Chapter 2: Improving Resources Management
Technical requirements
Unlocking and implementing bindless rendering
Checking for support
Creating the descriptor pool
Updating the descriptor set
Update to shader code
Automating pipeline layout generation
Compiling GLSL to SPIR-V
Understanding the SPIR-V output
From SPIR-V to pipeline layout
Improving load times with a pipeline cache
Summary
Further reading
Chapter 3: Unlocking Multi-Threading
Technical requirements
Task-based multi-threading using enkiTS
Why task-based parallelism?
Using the enkiTS (Task-Scheduler) library
Asynchronous loading
Creating the I/O thread and tasks
Vulkan queues and the first parallel command generation
The AsynchronousLoader class
Recording commands on multiple threads
The allocation strategy
Command buffer recycling
Primary versus secondary command buffers
Drawing using primary command buffers
Drawing using secondary command buffers
Spawning multiple tasks to record command buffers
Summary
Further reading
Chapter 4: Implementing a Frame Graph
Technical requirements
Understanding frame graphs
Building a graph
A data-driven approach
Implementing the frame graph
Implementing topological sort
Driving rendering with the frame graph
Summary
Further reading
Chapter 5: Unlocking Async Compute
Technical requirements
Replacing multiple fences with a single timeline semaphore
Enabling the timeline semaphore extension
Creating a timeline semaphore
Waiting for a timeline semaphore on the CPU
Using a timeline semaphore on the GPU
Adding a separate queue for async compute
Submitting work on separate queues
Implementing cloth simulation using async compute
Benefits of using compute shaders
Compute shaders overview
Writing compute shaders
Summary
Further reading
Part 2: GPU-Driven Rendering
Chapter 6: GPU-Driven Rendering
Technical requirements
Breaking down large meshes into meshlets
Generating meshlets
Understanding task and mesh shaders
Implementing task shaders
Implementing mesh shaders
GPU culling using compute
Depth pyramid generation
Occlusion culling
Summary
Further reading
Chapter 7: Rendering Many Lights with Clustered Deferred Rendering
Technical requirements
A brief history of clustered lighting
Differences between forward and deferred techniques
Implementing a G-buffer
Implementing light clusters
CPU lights assignment
GPU light processing
Summary
Further reading
Chapter 8: Adding Shadows Using Mesh Shaders
Technical requirements
A brief history of shadow techniques
Shadow volumes
Shadow mapping
Raytraced shadows
Implementing shadow mapping using mesh shaders
Overview
Cubemap shadows
A note about multiview rendering
Per-light mesh instance culling
Indirect draw commands generation
Shadow cubemap face culling
Meshlet shadow rendering – task shader
Meshlet shadow rendering – mesh shader
Shadow map sampling
Improving shadow memory with Vulkan’s sparse resources
Creating and allocating sparse textures
Choosing per-light shadow memory usage
Rendering into a sparse shadow map
Summary
Further reading
Chapter 9: Implementing Variable Rate Shading
Technical requirements
Introducing variable rate shading
Determining the shading rate
Integrating variable rate shading using Vulkan
Taking advantage of specialization constants
Summary
Further reading
Chapter 10: Adding Volumetric Fog
Technical requirements
Introducing Volumetric Fog Rendering
Volumetric Rendering
Volumetric Fog
Implementing Volumetric Fog Rendering
Data injection
Calculating the lighting contribution
Integrating scattering and extinction
Applying Volumetric Fog to the scene
Adding filters
Volumetric noise generation
Blue noise
Summary
Further reading
Part 3: Advanced Rendering Techniques
Chapter 11: Temporal Anti-Aliasing
Technical requirements
Overview
The simplest TAA implementation
Jittering the camera
Choosing jittering sequences
Adding motion vectors
First implementation code
Improving TAA
Reprojection
History sampling
Scene sampling
The history constraint
Resolve
Sharpening the image
Sharpness post-processing
Negative mip bias
Unjitter texture UVs
Improving banding
Summary
Further reading
Chapter 12: Getting Started with Ray Tracing
Technical requirements
Introduction to ray tracing in Vulkan
Building the BLAS and TLAS
Defining and creating a ray tracing pipeline
Summary
Further reading
Chapter 13: Revisiting Shadows with Ray Tracing
Technical requirements
Implementing simple ray-traced shadows
Improving ray-traced shadows
Motion vectors
Computing visibility variance
Computing visibility
Computing filtered visibility
Using the filtered visibility
Summary
Further reading
Chapter 14: Adding Dynamic Diffuse Global Illumination with Ray Tracing
Technical requirements
Introduction to indirect lighting
Introduction to Dynamic Diffuse Global Illumination (DDGI)
Ray tracing for each probe
Probes offsetting
Probes irradiance and visibility updates
Probes sampling
Implementing DDGI
Ray-generation shader
Ray-hit shader
Ray-miss shader
Updating probes irradiance and visibility shaders
Indirect lighting sampling
Modifications to the calculate_lighting method
Probe offsets shader
Summary
Further reading
Chapter 15: Adding Reflections with Ray Tracing
Technical requirements
How screen-space reflections work
Implementing ray-traced reflections
Implementing a denoiser
Summary
Further reading
Index
Other Books You May Enjoy