This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX

Apress Source Code

This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX by Adam Marrs, Peter Shirley, and Ingo Wald (Apress, 2021).

See http://raytracinggems.com for further information about the book.

Cover image

Download the files as a zip using the green button, or clone the repository to your machine using Git.

Releases

Errata for the book is available here.

Release v1.0 corresponds to the code in the published book, without corrections or updates.

Contributions

See Contributing for information on how you can contribute to this repository.

License

All code here is released under the MIT License, copyright 2021 NVIDIA Corporation, unless otherwise noted within an individual chapter's files. This license reads as follows:

Copyright 2021 NVIDIA Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Owner
Apress
Source code for books published by Apress. For more information go to www.apress.com/source-code.
Apress
Similar Resources

Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.

Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.

Legion-LLRI Legion-LLRI, or “Legion Low Level Rendering Interface” is a rendering API that aims to provide a graphics API agnostic approach to graphic

Dec 6, 2022

ORE (OpenGL Rendering Engine) is a rendering engine developed for my college minor project assessment.

ORE (OpenGL Rendering Engine) is a rendering engine developed for my college minor project assessment.

ORE (OPENGL RENDERING ENGINE) What is ORE? ORE(OpenGL Rendering Engine) is a rendering engine with great and easy to use UI that allows the user to lo

Sep 23, 2022

Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup

Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup

A minimalist and platform-agnostic interactive/real-time raytracer. Strong emphasis on simplicity, ease of use and almost no setup to get started with

Dec 28, 2022

A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

GLFW Introduction GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platf

Jan 1, 2023

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) Documentation NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accept

Jan 8, 2023

This repo will sort of document my story of learning vulkan with VulkanSDK and cl (msvc) on windows.

This repo will sort of document my story of learning vulkan with VulkanSDK and cl (msvc) on windows.

Learning Vulkan This repo is a means of documenting my journey with learning Vulkan's basics on windows. Because of the binaries in the LunarG VulkanS

Dec 8, 2021

基于 Vulkan 实现的 GPUImage

Vulkan-GPUImage 基于 Vulkan 渲染的 GPUImage 版本,实现渲染链机制,复刻 GPUImage 上的多个效果(逐渐增加中)。 更多技术实现,详见源码~~ Vulkan 学习文章 进击的 Vulkan 移动开发(一)之今生前世 进击的 Vulkan 移动开发之 Instan

Nov 15, 2022

Minimal pathtracer using Vulkan RayTracing

Minimal pathtracer using Vulkan RayTracing

Single File Vulkan Pathtracing Minimal pathtracer using Vulkan RayTracing Environment Vulkan SDK 1.2.162.0 GPU / Driver that support Vulkan Ray Tracin

Dec 21, 2022

OBS Linux Vulkan/OpenGL game capture

OBS Linux Vulkan/OpenGL game capture OBS plugin for Vulkan/OpenGL game capture on Linux. Requires OBS with EGL support (currently unreleased, you need

Jan 1, 2023
Comments
  • ERROR: VUID-vkCmdBuildAccelerationStructuresKHR-geometry-03673

    ERROR: VUID-vkCmdBuildAccelerationStructuresKHR-geometry-03673

    ERROR: VUID-vkCmdBuildAccelerationStructuresKHR-geometry-03673 --> Validation Error: [ VUID-vkCmdBuildAccelerationStructuresKHR-geometry-03673 ] Object 0: handle = 0x19a7cf724f0, type = VK_OBJECT_TYPE_DEVICE; Object 1: handle = 0xd5b26f0000000010, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x8a7de95d | vkCmdBuildAccelerationStructuresKHR(): The buffer associated with pInfos[0].pGeometries[0].geometry.instances.data was not created with VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR. The Vulkan spec states: The buffers from which the buffer device addresses for all of the geometry.triangles.vertexData, geometry.triangles.indexData, geometry.triangles.transformData, geometry.aabbs.data, and geometry.instances.data members of all pInfos[i].pGeometries and pInfos[i].ppGeometries are queried must have been created with the VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR usage flag (https://vulkan.lunarg.com/doc/view/1.3.216.0/windows/1.3-extensions/vkspec.html

  • Chapter 4 code listing

    Chapter 4 code listing

    Listing 4-1, is:

    vec3 tmpu = P - A, tmpv = P - B, tmpw = P - C // ... vec3 Pp = P + u*tmpu + v*tmpv + w*tmpw

    As source Spectral light transport simulation using a precision-based ray tracing architecture is quoted. Here, the last line looks like this (adjusting for code style):

    vec3 Pp = u*(A + tmpu) + v*(B + tmpv) + w*(C + tmpw)

    I don´t think they are equivalent, and the first version gives me unexpected results. Is this a mistake?

  • Removed warnings from validation layer.

    Removed warnings from validation layer.

    I'm studing Vulkan Raytracing. While reading "Ray Tracing Gems II", I found a mistake.

    In Chapter 16 "INTRODUCTION TO VULKAN RAY TRACING", I seem to it needed "VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR". (at List 16-18)

    i use Vulkan SDK version 1.2.182.0.

  • Chapter 23 Figure 23-4 updateReservoir function

    Chapter 23 Figure 23-4 updateReservoir function

    @acmarrs-nvidia Hey Adam! In Chapter 23, Figure 23-4, the code as listed looks like the following:

    function updateReservoir(Reservoir result, Reservoir input)
        result.totalWeight+= input.weight;
        result.M++;
        if rand() < (input.weight/result.totalWeight) then
            result.sample = input.sample;
            result.sampleTargetPdf = input.sampleTargetPdf;
        return result;
    
    function mergeReservoirs(Reservoir r1, Reservoir r2)
        Reservoir merged;
        updateReservoir(merged, r1);
        updateReservoir(merged, r2);
        merged.M = r1.M + r2.M;
        return merged;
    

    As written, this code works but I believe updateReservoir has a bug in it, specifically related to the update of result.M (which denotes the sample count). I believe the correct update should be result.M += input.M;. Note that the listing as a whole works provided the user only uses mergeReservoirs because merged.M is overwritten with the correct result afterwards. A refactored code listing might look like:

    function updateReservoir(Reservoir result, Reservoir input)
        result.totalWeight+= input.weight;
        result.M += input.M;
        if rand() < (input.weight/result.totalWeight) then
            result.sample = input.sample;
            result.sampleTargetPdf = input.sampleTargetPdf;
        return result;
    
    function mergeReservoirs(Reservoir r1, Reservoir r2)
        Reservoir merged = r1;
        updateReservoir(merged, r2);
        return merged;
    

    Note: the only distinction between mergeReservoirs and updateReservoir as implemented above is that the former leaves its arguments r1 and r2 unchanged, while updateReservoir mutates the first argument.

ReferencePT - Supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer
ReferencePT - Supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer

The Reference Path Tracer Code sample This is a supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer. Code is bas

Dec 20, 2022
Implementing Nvidia DXR tutorial with Microsoft DXR Fallback Layer

DXRNvTutorial Implemented the Nvidia DXR tutorial with Microsoft DXR Fallback Layer, tested on Nvidia GTX 980Ti (AMD won't work). Extended nv_helpers_

Sep 21, 2019
Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.
Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.

Ray Tracing In Vulkan My implementation of Peter Shirley's Ray Tracing in One Weekend books using Vulkan and NVIDIA's RTX extension (formerly VK_NV_ra

Dec 31, 2022
A toy renderer written in C using Vulkan to perform real-time ray tracing research.

This is a toy renderer written in C using Vulkan. It is intentionally minimalist. It has been developed and used for the papers "BRDF Importance Sampl

Dec 19, 2022
A path tracer based on hardware ray tracing

GoldenSun GoldenSun is a GPU path tracer. It uses hardware ray tracing APIs to do the tracing. As an experimental project, there is no release plan, n

Feb 27, 2022
My implementations of Ray Tracing in One Weekend written in many different languages.

Ray Tracing in Many Languages This repository contains my implementation of the Ray Tracing in One Weekend book written in several different programmi

Oct 19, 2021
Implementation of light baking system for ray tracing based on Activision's UberBake

Vulkan Light Bakery MSU Graphics Group Student's Diploma Project Treefonov Andrey [GitHub] [LinkedIn] EARLY STAGES OF DEVELOPMENT Project Goal The goa

Dec 27, 2022
Getting Started with RTX Ray Tracing

Getting Started with RTX Ray Tracing This directory contains Chris Wyman's shader tutorials from the GDC 2019 and SIGGRAPH 2018 courses "Introduction

Jan 8, 2023
Dec 31, 2022
Vulkan Minimal Hybrid Rendering
Vulkan Minimal Hybrid Rendering

Vulkan Minimal Hybrid Rendering A minimal hybrid rendering sample using ray query Features Rasterization Raytraced shadow Environment Vulkan SDK 1.2.1

Aug 31, 2022