3D Graphics Rendering Cookbook: A comprehensive guide to exploring rendering algorithms in modern OpenGL and Vulkan [1 ed.] 1838986197, 9781838986193

Build a 3D rendering engine from scratch while solving problems in a step-by-step way with the help of useful recipes Ke

658 61 12MB

English Pages 670 Year 2021

Report DMCA / Copyright

DOWNLOAD FILE

3D Graphics Rendering Cookbook: A comprehensive guide to exploring rendering algorithms in modern OpenGL and Vulkan [1 ed.]
 1838986197, 9781838986193

Table of contents :
Cover
Copyright
Contributors
Table of Contents
Preface
Chapter 1: Establishing a Build Environment
Technical requirements
OpenGL 4.6 with AZDO and Vulkan
What is the essence of modern OpenGL?
Setting up our development environment on Windows
Getting ready
How to do it...
There's more...
Setting up our development environment on Linux
Getting ready
How to do it...
Installing the Vulkan SDK for Windows and Linux
Getting ready
How to do it...
There's more...
Managing dependencies
Getting ready
How to do it...
How it works...
There's more...
Getting the demo data
How to do it
There's more...
Creating utilities for CMake projects
Getting ready
How to do it...
There's more...
Chapter 2: Using Essential Libraries
Technical requirements
Using the GLFW library
Getting ready
How to do it...
There's more...
Doing math with GLM
Getting ready
How to do it...
There's more...
Loading images with STB
Getting ready
How to do it...
There's more...
Rendering a basic UI with Dear ImGui
Getting ready
How to do it...
There's more…
Integrating EasyProfiler
Getting ready
How to do it...
How it works...
There's more...
Integrating Optick
Getting ready
How to do it...
How it works...
There's more…
Using the Assimp library
Getting ready
How to do it...
Getting started with Etc2Comp
Getting ready
How to do it...
There's more...
Multithreading with Taskflow
Getting ready
How to do it...
There's more...
Introducing MeshOptimizer
Getting ready
How to do it...
There's more...
Chapter 3: Getting Started with OpenGL and Vulkan
Technical requirements
Intercepting OpenGL API calls
Getting ready
How to do it...
How it works...
Working with Direct State Access (DSA)
Getting ready
How to do it...
There's more...
Loading and compiling shaders in OpenGL
Getting ready
How to do it...
There's more...
Implementing programmable vertex pulling (PVP) in OpenGL
Getting ready
How to do it...
How it works...
There's more...
Working with cube map textures
Getting ready
How to do it...
There's more...
Compiling Vulkan shaders at runtime
Getting ready
How to do it...
How it works...
There's more...
Initializing Vulkan instances and graphical devices
Getting ready
How to do it...
Initializing the Vulkan swap chain
Getting ready
How to do it...
Setting up Vulkan's debugging capabilities
How to do it...
There's more…
Tracking and cleaning up Vulkan objects
Getting ready
How to do it...
Using Vulkan command buffers
How to do it...
See also
Dealing with buffers in Vulkan
Getting ready
How to do it...
How it works...
Using texture data in Vulkan
Getting ready
How to do it...
Using mesh geometry data in Vulkan
Getting ready
How to do it...
Using Vulkan descriptor sets
How to do it...
There's more…
Initializing Vulkan shader modules
Getting ready
How to do it...
Initializing the Vulkan pipeline
Getting ready...
How to do it...
There's more…
See also
Putting it all together into a Vulkan application
Getting ready
How to do it...
Chapter 4: Adding User Interaction and Productivity Tools
Technical requirements
Organizing Vulkan frame rendering code
Getting ready
How to do it...
There's more…
Organizing mesh rendering in Vulkan
Getting ready
How to do it...
Implementing an immediate mode drawing canvas
Getting ready
How to do it...
Rendering a Dear ImGui user interface with Vulkan
Getting ready
How to do it...
Working with a 3D camera and basic user interaction
Getting ready
How to do it...
How it works...
There's more...
Adding a frames-per-second counter
Getting ready
How to do it...
There's more...
Adding camera animations and motion
Getting ready
How to do it...
How it works...
There's more...
Integrating EasyProfiler and Optick into C++ applications
Getting ready
How to do it...
How it works...
Using cube map textures in Vulkan
Getting ready
How to do it...
Rendering onscreen charts
Getting ready
How to do it...
How it works...
Putting it all together into a Vulkan application
Getting ready
How to do it...
Chapter 5: Working with Geometry Data
Technical requirements
Organizing the storage of mesh data
Getting ready
How to do it...
How it works...
There's more...
Implementing a geometry conversion tool
Getting ready
How to do it...
How it works...
There's more...
Indirect rendering in Vulkan
Getting ready
How to do it...
There's more...
Implementing an infinite grid GLSL shader
Getting ready
How to do it...
There's more...
Rendering multiple meshes with OpenGL
Getting ready
How to do it…
Generating LODs using MeshOptimizer
Getting ready
How to do it...
There's more...
Integrating tessellation into the OpenGL graphics pipeline
Getting ready
How to do it...
There's more...
Chapter 6: Physically Based Rendering Using the glTF2 Shading Model
Technical requirements
Simplifying Vulkan initialization and frame composition
How to do it...
Initializing compute shaders in Vulkan
Getting ready
How to do it...
There's more...
Using descriptor indexing and texture arrays in Vulkan
Getting ready
How to do it...
There's more...
Using descriptor indexing in Vulkan to render an ImGui
Getting ready
How to do it...
Generating textures in Vulkan using compute shaders
Getting ready
How to do it...
Implementing computed meshes in Vulkan
Getting ready
How to do it...
There's more...
Precomputing BRDF LUTs
Getting ready
How to do it...
There's more...
Precomputing irradiance maps and diffuse convolution
Getting ready
How to do it...
There's more...
Implementing the glTF2 shading model
Getting ready
How to do it...
There's more...
Chapter 7: Graphics Rendering Pipeline
Technical requirements
How not to do a scene graph
Using data-oriented design for a scene graph
Getting ready
How to do it...
There's more...
Loading and saving a scene graph
Getting ready
How to do it...
There's more...
Implementing transformation trees
Getting ready
How to do it...
There's more...
Implementing a material system
Getting ready
How to do it...
Importing materials from Assimp
Getting ready
How to do it...
There's more...
Implementing a scene conversion tool
Getting ready
How to do it...
There's more...
Managing Vulkan resources
Getting ready
How to do it...
There's more...
Refactoring Vulkan initialization and the main loop
Getting ready
How to do it...
Working with rendering passes
Getting ready
How to do it...
There's more...
Unifying descriptor set creation routines
Getting ready
How to do it...
There's more...
Putting it all together into a Vulkan application
Getting ready
How to do it...
How it works…
There's more...
Chapter 8: Image-Based Techniques
Technical requirements
Implementing offscreen rendering in OpenGL
Getting ready
How to do it…
Implementing fullscreen quad rendering
Getting ready
How to do it…
There's more...
Implementing shadow maps in OpenGL
Getting ready
How to do it…
There's more…
Implementing SSAO in OpenGL
Getting ready
How to do it...
There's more...
Implementing HDR rendering and tone mapping
Getting ready
How to do it...
There's more...
Implementing HDR light adaptation
Getting ready
How to do it...
There's more...
Writing postprocessing effects in Vulkan
Getting ready...
How to do it...
Implementing SSAO in Vulkan
Getting ready...
How to do it...
Implementing HDR rendering in Vulkan
Getting ready…
How to do it...
There's more…
Chapter 9: Working with Scene Graphs
Technical requirements
Deleting nodes and merging scene graphs
How to do it...
Finalizing the scene-converter tool
Getting ready
How to do it...
There's more...
Implementing lightweight rendering queues in OpenGL
Getting ready
How to do it...
There's more...
Working with shape lists in Vulkan
Getting ready
How to do it...
Adding Bullet physics to a graphics application
Getting ready
How to do it...
There's more...
Chapter 10: Advanced Rendering Techniques and Optimizations
Technical requirements
Doing frustum culling on the CPU
Getting ready
How to do it…
There's more...
Doing frustum culling on the GPU with compute shaders
Getting ready
How to do it…
There's more...
Implementing order-independent transparency
Getting ready
How to do it…
Loading texture assets asynchronously
Getting ready
How to do it...
There's more...
Implementing projective shadows for directional lights
Getting ready
How to do it...
There's more...
Using GPU atomic counters in Vulkan
Getting ready
How to do it...
There's more…
Putting it all together into an OpenGL demo
Getting ready
How to do it...
There's more…
Other Books You May Enjoy
Index

Polecaj historie