A rendering sample that demonstrates bindless deferred texturing using D3D12

Overview

Bindless Deferred Texturing and Decals Sample

This project is a D3D12 rendering sample that implements a deferred renderer using bindless deferred texturing. Deferred texturing is similar to normal deferred rendering, except that textures are not sampled in the geometry pass. Instead, the interpolated UV's are written into the G-Buffer so that the material textures can be sampled during the deferred pass. To enable sampling of textures from arbitrary materials, the demo makes use of dynamic indexing of texture descriptors. The demo also implements a deferred decal system using a clustering technique that's compatible with both deferred texturing as well as clustered forward rendering (which is also implemented in the demo as a baseline for comparison).

See the full blog post for more info: https://therealmjp.github.io/posts/bindless-texturing-for-deferred-rendering-and-decals/

Build Instructions

The repository contains a Visual Studio 2015 project and solution file that's ready to build on Windows. All external dependencies are included in the repository, so there's no need to download additional libraries. Running the demo requires Windows 10, as well as a GPU that supports Feature Level 11_1.

Using The Demo App

To move the camera, press the W/S/A/D/Q/E keys. The camera can also be rotated by right-clicking on the window and dragging the mouse. To place new decals, click the middle mouse button. Everything else is controlled through the in-app settings UI.

Using the new DirectX Shader Compiler

This project supports using the new open-source HLSL compiler (also known as DXC), with support for Shader Model 6.0+. Usage of the new compiler is controlled by the "EnableShaderModel6_" macro that's defined in AppConfig.h. If you enable this flag, you'll want to make sure that you're on Windows 10 version 1803 or later to enable retail support for loading DXIL. If you're on an earlier Win10 version or an older driver, you may need to enable experimental feature support for D3D12ExperimentalShaderModels (see DX12.cpp for some code you can enable to do this).

Issues
  • Roughness maps not being loaded

    Roughness maps not being loaded

    I don't know if it's just me but I noticed that the roughness maps weren't being loaded. The model didn't seem to have any textures of type aiTextureType_SHININESS. This is on the latest version of the master branch with VS2017.

    https://github.com/TheRealMJP/DeferredTexturing/blob/fe52746f13fc3762abdb53d9d2272ffcafd871eb/SampleFramework12/v1.01/Graphics/Model.cpp#L499-L500

    opened by rskryptik61636 3
  • Hitting assert a break in ResourceUploadEnd

    Hitting assert a break in ResourceUploadEnd

    Hey Matt,

    Using VS2017 and hitting an break in ResourceUploadEnd`` inDX12_Upload.cpp```:

    D3D12 ERROR: ID3D12CommandQueue::ExecuteCommandLists: Simultaneous-access or Buffer Resource (0x0000024F386C7940:'Decal Buffer') is still referenced by transition_barrier GPU operations in-flight on another Command Queue (0x0000024F24C657F0:'Unnamed ID3D12CommandQueue Object'). It is not safe to start write GPU operations now on this Command Queue (0x0000024F24CBB4C0:'Unnamed ID3D12CommandQueue Object'). This can result in race conditions and application instability. [ EXECUTION ERROR #1047: OBJECT_ACCESSED_WHILE_STILL_IN_USE]
    D3D12: **BREAK** enabled for the previous message, which was: [ ERROR EXECUTION #1047: OBJECT_ACCESSED_WHILE_STILL_IN_USE ]
    

    I poked around a bit but couldn't figure out what was going on. Was wondering if you had seen something like this on VS2017?

    opened by chaoticbob 3
  • Isn't the ground albedo a reflectance?

    Isn't the ground albedo a reflectance?

    In the sample framework code Skybox.cpp you compute the spectrum for the ground albedo using

     SampledSpectrum groundAlbedoSpectrum = SampledSpectrum::FromRGB(Albedo);
    

    By default PBRT assumes FromRGB is getting an illuminant, but isn't the ground albedo providing reflectance? I'd have expected

     SampledSpectrum groundAlbedoSpectrum = SampledSpectrum::FromRGB(Albedo,  SpectrumType::Reflectance);
    
    opened by ekmett 3
  • Any reason to require Feature Level 12_0?

    Any reason to require Feature Level 12_0?

    It actually works pretty well on AMD GCN Gen1 (tested on R9 280, which is actually a re-branded HD7950 at higher clock speed). Of course I modified the code to require FL 11_1. It does not run on Haswell (FL 11_1 too). The first GPU is like all other FL 12_0 AMD GPUs (GCN Gen2 and beyond) except for tiled resources (tier 1 instead of tier 2), while hasswell does not support tiled resources at all (31-bit virtual address pain) and it is a tier 1 in resource binding (so no real bindless capabilities). Maybe I just ignoring something, I did not deeply check the code now....

    opened by alessiot89 2
  • MSBuild error MSB8066 - Custom build failing

    MSBuild error MSB8066 - Custom build failing

    Hi, I'm using VS2022 and I get the following error message when building the project:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error	MSB8066	Custom build for '..\Externals\Assimp-3.1.1\bin\assimp.dll;AppSettings.cs;..\Externals\WinPixEventRuntime\bin\WinPixEventRuntime.dll;..\Externals\DXCompiler\Bin\dxcompiler.dll;..\Externals\DXCompiler\Bin\dxil.dll' exited with code 1.	BindlessDeferred_2019	C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets	245	
    
    

    I tried both solutions. And installing pix and assimp packages manually. Running on Win10 21H2 - GTX 1060

    opened by omd24 1
  • [SampleFramework12] Fix potential upload ordering problem

    [SampleFramework12] Fix potential upload ordering problem

    (disclaimer: I didn't test this project nor this 'fix', I just read some of the code, so take this with a grain of salt)

    The submissions are allocated from ResourceUploadBegin, but their fence value are only populated from ResourceUploadEnd. Hence, a submission A could potentially have a bigger fence value than a later allocated submission B. I think it could create an issue here: submission A's fence could be not signaled while submission B's would be signaled, and this code would invalidate the ring buffer's implicit fifo contract (as it would try to remove submission B without first removing submission A). It would probably crash on Assert_(submission.Offset == UploadBufferStart);

    To further explicit the fifo contract, one could also add at the beginning of the Signaled block: Assert_(idx == UploadSubmissionStart);

    opened by jbigalet 1
  • Program Crash

    Program Crash

    • detailed error info:
    D3D12 ERROR: ID3D12Device::CreateComputeShader: Shader is corrupt or in an unrecognized format. [ STATE_CREATION ERROR #322: CREATECOMPUTESHADER_INVALIDSHADERBYTECODE]
    D3D12: **BREAK** enabled for the previous message, which was: [ ERROR STATE_CREATION #322: CREATECOMPUTESHADER_INVALIDSHADERBYTECODE ]
    
    • Debug version build by vs2017
    • Run through VS debuger.
    opened by ychding11 1
  • CustomBuildEvent attempting to copy non-existent dxcompiler.dll causes the build to fail

    CustomBuildEvent attempting to copy non-existent dxcompiler.dll causes the build to fail

    The following entry in BindlessDeferred.vcxproj attempts to copy the nonexistent dxcompiler.dll from the ..\Externals\DXCompiler\Bin folder to the output folder which causes the build to fail. Removing the offending entry fixes the issue.

    https://github.com/TheRealMJP/DeferredTexturing/blob/7767a72624519181b194bf62c6a4a361a0390f81/BindlessDeferred/BindlessDeferred.vcxproj#L231-L235

    opened by rskryptik61636 1
  • Exception thrown by SetComputeRootDescriptorTable call in RenderDeferred() due to invalid resource state (occurs only in the Debug build)

    Exception thrown by SetComputeRootDescriptorTable call in RenderDeferred() due to invalid resource state (occurs only in the Debug build)

    An exception is thrown at the following call in the RenderDeferred() method in the Debug build: cmdList->SetComputeRootDescriptorTable(Deferred_Descriptors, tableStart.GPUHandle);

    The error message output by the DX debug layer is as follows: D3D12 ERROR: CCommandList::SetComputeRootDescriptorTable: Resource state (0xA0: D3D12_RESOURCE_STATE_DEPTH_READ|D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) of resource (0x000001A4B11975D0:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a NON_PIXEL_SHADER_RESOURCE. Expected State Bits (all): 0x40: D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, Actual State: 0xA0: D3D12_RESOURCE_STATE_DEPTH_READ|D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, Missing State: 0x40: D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE. This validation is being enforced at bind during command list recording because the descriptor for this resource in the root signature is declared as DATA_STATIC_WHILE_SET_AT_EXECUTE. [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]

    What's odd is that the only resource that is ever in a state of 'D3D12_RESOURCE_STATE_DEPTH_READ|D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE' is the depth buffer and that is transitioned to 'D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_DEPTH_READ' before the call to SetComputeRootDescriptorTable. Not sure why the runtime is throwing this error, maybe its some other resource?

    I get the same error if I create a WARP device so I don't think it might be a driver issue.

    My system config is as follows: CPU: Intel i7-4770k GPU: NVIDIA GeForce GTX 1060 6 GB RAM: 8 GB Driver version: 375.70 (Release date: 10/27/2016)

    opened by rskryptik61636 1
  • HosekSky old compiler

    HosekSky old compiler

    Hello, I tried compile demo with MSVC 2017. Need update libs.

    Severity	Code	Description	Project	File	Line	Suppression State
    Error	C1047	The object or library file '..\Externals\HosekSky\Lib 2015\HosekSky.lib' was created with an older compiler than other objects; rebuild old objects and libraries	BindlessDeferred	C:\Users\capitalknew\Documents\DeferredTexturing\BindlessDeferred\LINK	1	
    
    opened by ghost 2
Releases(v1.0)
DirectX 11 and 12 library that provides a scalable and GCN-optimized solution for deferred shadow filtering

AMD ShadowFX The ShadowFX library provides a scalable and GCN-optimized solution for deferred shadow filtering. Currently the library supports uniform

GPUOpen Effects 163 Jun 23, 2022
A fork of Microsoft's D3D12 Raytracing Fallback Layer

D3D12 Raytracing Fallback Layer The D3D12 Raytracing Fallback Layer is a library that emulates the DirectX Raytracing (DXR) API on devices without nat

Phil Guo 7 Dec 15, 2021
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

Rythe Interactive 25 Mar 8, 2022
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

HARSHIT BARGUJAR 4 Dec 20, 2021
Demonstrates basic advantages of integrating the Data Distribution Service (DDS) and Time-Sensitive Networking (TSN) Ethernet.

ROS2-DDS-TSN integration demo This repository demonstrates basic advantages of integrating the Data Distribution Service (DDS) and Time-Sensitive Netw

NXP 40 Jun 17, 2022
Axel Gneiting 1.3k Jun 24, 2022
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

bgfx - Cross-platform rendering library GitHub Discussions Discord Chat What is it? Cross-platform, graphics API agnostic, "Bring Your Own Engine/Fram

Бранимир Караџић 11.8k Jul 2, 2022
A modern cross-platform low-level graphics library and rendering framework

Diligent Engine A Modern Cross-Platform Low-Level 3D Graphics Library Diligent Engine is a lightweight cross-platform graphics API abstraction library

Diligent Graphics 2.4k Jun 29, 2022
Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.

Horde3D Horde3D is a 3D rendering engine written in C++ with an effort being as lightweight and conceptually clean as possible. Horde3D requires a ful

Volker Vogelhuber 1.2k Jun 22, 2022
Single header C library for rendering truetype text to the screen

kc_truetypeassembler.h Single header C library for assembling textured quads for text rendering using a graphics API. It generates a vertices and text

Kevin Chin 21 Jun 15, 2022
SoL (for Speed of Light, or sun in Spanish) is a Physically-based rendering library written in modern C++

SoL (for Speed of Light, or sun in Spanish) is a small rendering library written in C++20. Its goal is to strike a good balance between performance and usability, and allow easy experimentation for rendering researchers.

Arsène Pérard-Gayot 10 May 19, 2022
A C++/DirectX 11 implementation of "A Scalable and Production Ready Sky and Atmosphere Rendering Technique"

Atmosphere Renderer A C++/DirectX 11 implementation of "A Scalable and Production Ready Sky and Atmosphere Rendering Technique" Features interactive e

Z Guan 29 Jun 23, 2022
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

Apress 635 Jun 21, 2022
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

Yuki Nishidate 7 Aug 16, 2021
⚡High-performance rendering for python

ZenGL ZenGL is a minimalist Python module providing exactly one way to render scenes with OpenGL. pip install zengl Documentation zengl on Github zen

Szabolcs Dombi 121 Jun 18, 2022
NVRHI (NVIDIA Rendering Hardware Interface) is a library that implements a common abstraction layer over multiple graphics APIs

NVRHI Introduction NVRHI (NVIDIA Rendering Hardware Interface) is a library that implements a common abstraction layer over multiple graphics APIs (GA

NVIDIA GameWorks 381 Jun 19, 2022
Source Code for "Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs" by Eric Haines and Tomas Akenine-Möller

Apress Source Code This repository accompanies Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs by Eric Haines and Tomas

Apress 819 Jun 15, 2022
Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.

pbrt, Version 3 This repository holds the source code to the version of pbrt that is described in the third edition of Physically Based Rendering: Fro

Matt Pharr 4.2k Jun 22, 2022
appleseed is an open source, physically-based global illumination rendering engine primarily designed for animation and visual effects.

appleseed is an open source, physically-based global illumination rendering engine primarily designed for animation and visual effects.

appleseedhq 1.9k Jun 21, 2022