Top Related Projects
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.
One stop solution for all Vulkan samples
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
Unity Graphics - Including Scriptable Render Pipeline
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Quick Overview
Falcor is a real-time rendering framework developed by NVIDIA. It is designed to serve as a platform for research and experimentation in graphics, providing a high-performance, extensible foundation for developing advanced rendering techniques and applications.
Pros
- Highly optimized for NVIDIA GPUs, offering excellent performance
- Extensive set of rendering features and algorithms out-of-the-box
- Modular architecture allows for easy extension and customization
- Active development and support from NVIDIA
Cons
- Steep learning curve for beginners due to its complexity
- Limited documentation compared to some other rendering frameworks
- Primarily focused on NVIDIA hardware, which may limit portability
- Requires a powerful GPU for optimal performance
Code Examples
- Creating a simple scene:
// Create a new scene
Scene::SharedPtr pScene = Scene::create();
// Add a camera to the scene
Camera::SharedPtr pCamera = Camera::create("Main Camera");
pScene->addCamera(pCamera);
// Add a light to the scene
DirectionalLight::SharedPtr pLight = DirectionalLight::create("Sun");
pScene->addLight(pLight);
// Add a mesh to the scene
Mesh::SharedPtr pMesh = Mesh::createFromFile("models/cube.obj");
pScene->addMesh(pMesh);
- Setting up a render pass:
// Create a render pass
RenderPass::SharedPtr pRenderPass = RenderPass::create("MyRenderPass");
// Set the render state
RenderState::SharedPtr pRenderState = RenderState::create();
pRenderState->setDepthStencilState(DepthStencilState::create());
pRenderPass->setRenderState(pRenderState);
// Set the program
Program::Desc programDesc;
programDesc.addShaderLibrary("shaders/MyShader.slang").vsEntry("vsMain").psEntry("psMain");
pRenderPass->setProgram(Program::create(programDesc));
- Rendering a frame:
// Get the current render context
RenderContext* pRenderContext = gpDevice->getRenderContext();
// Clear the render target
pRenderContext->clearRtv(pRenderTarget->getRTV(), float4(0.0f, 0.0f, 0.0f, 1.0f));
// Render the scene
pScene->render(pRenderContext, pCamera);
// Present the frame
pSwapChain->present();
Getting Started
-
Clone the Falcor repository:
git clone https://github.com/NVIDIAGameWorks/Falcor.git
-
Install dependencies (Visual Studio 2019, Python 3.x, CMake 3.15+)
-
Run the setup script:
python setup.py
-
Open the generated solution file in Visual Studio and build the project
-
Run one of the sample applications to verify the installation
Competitor Comparisons
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.
Pros of DirectX-Graphics-Samples
- Comprehensive coverage of DirectX features and techniques
- Official Microsoft samples, ensuring up-to-date and best practices
- Wide range of examples from basic to advanced concepts
Cons of DirectX-Graphics-Samples
- Focused solely on DirectX, limiting cross-platform development
- Less emphasis on high-level rendering techniques and abstractions
- May require more setup and configuration for each sample
Code Comparison
DirectX-Graphics-Samples (D3D12HelloTriangle.cpp):
ComPtr<ID3D12Resource> m_vertexBuffer;
D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView;
const UINT vertexBufferSize = sizeof(triangleVertices);
// Create the vertex buffer.
ThrowIfFailed(m_device->CreateCommittedResource(
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD),
D3D12_HEAP_FLAG_NONE,
&CD3DX12_RESOURCE_DESC::Buffer(vertexBufferSize),
D3D12_RESOURCE_STATE_GENERIC_READ,
nullptr,
IID_PPV_ARGS(&m_vertexBuffer)));
Falcor (Buffer.cpp):
Buffer::SharedPtr Buffer::create(size_t size, BindFlags bindFlags, CpuAccess cpuAccess, const void* pInitData)
{
Buffer::SharedPtr pBuffer = SharedPtr(new Buffer(size, bindFlags, cpuAccess));
if (pInitData)
{
pBuffer->setBlob(pInitData, 0, size);
}
return pBuffer;
}
One stop solution for all Vulkan samples
Pros of Vulkan-Samples
- Focuses specifically on Vulkan, providing a comprehensive set of samples for this API
- Officially supported by the Khronos Group, ensuring up-to-date and standard-compliant examples
- Includes a wide range of samples covering various Vulkan features and best practices
Cons of Vulkan-Samples
- Limited to Vulkan, not suitable for projects using other graphics APIs
- May lack some advanced rendering techniques and effects found in Falcor
- Less emphasis on high-level abstractions and engine-like features
Code Comparison
Vulkan-Samples (Vulkan initialization):
VkInstanceCreateInfo instance_info{};
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
vkCreateInstance(&instance_info, nullptr, &instance);
Falcor (Scene creation):
Scene::SharedPtr scene = Scene::create("MyScene");
Camera::SharedPtr camera = Camera::create();
scene->addCamera(camera);
The Vulkan-Samples code demonstrates low-level Vulkan API usage, while Falcor provides higher-level abstractions for scene management and rendering.
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
Pros of Filament
- Cross-platform support: Android, iOS, Windows, macOS, Linux, and WebGL
- Lightweight and optimized for mobile devices
- Extensive documentation and examples
Cons of Filament
- Less focus on advanced rendering techniques compared to Falcor
- Smaller community and ecosystem
- Limited support for real-time ray tracing
Code Comparison
Filament (C++):
#include <filament/Engine.h>
#include <filament/Renderer.h>
filament::Engine* engine = filament::Engine::create();
filament::Renderer* renderer = engine->createRenderer();
Falcor (C++):
#include "Falcor.h"
Falcor::Renderer::SharedPtr renderer = Falcor::Renderer::create();
Falcor::RenderContext::SharedPtr pRenderContext = renderer->createRenderContext();
Both frameworks provide abstraction layers for rendering, but Falcor's API is more focused on high-end graphics research and development, while Filament aims for broader platform support and mobile optimization.
Unity Graphics - Including Scriptable Render Pipeline
Pros of Graphics
- More comprehensive rendering pipeline, covering a wider range of graphics techniques
- Better integration with Unity's ecosystem, making it easier for Unity developers to use
- Larger community and more frequent updates due to Unity's popularity
Cons of Graphics
- Potentially more complex to use for standalone graphics projects
- May have performance overhead due to Unity's abstraction layers
- Less focused on cutting-edge rendering techniques compared to Falcor
Code Comparison
Graphics (Unity SRP):
public class CustomRenderPipeline : RenderPipeline
{
protected override void Render(ScriptableRenderContext context, Camera[] cameras)
{
// Custom rendering logic here
}
}
Falcor:
void MyRenderGraph::onRender(RenderContext* pRenderContext, const RenderData& renderData)
{
// Custom rendering logic here
}
Both frameworks allow for custom rendering pipelines, but Graphics is more tightly integrated with Unity's structure, while Falcor provides a lower-level API for more direct control over rendering.
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Pros of bgfx
- Cross-platform support for multiple rendering APIs (DirectX, OpenGL, Vulkan, etc.)
- Lightweight and modular design, allowing for easy integration into existing projects
- Active community and frequent updates
Cons of bgfx
- Steeper learning curve due to lower-level API
- Less built-in support for advanced rendering techniques
- Limited documentation compared to Falcor
Code Comparison
bgfx:
bgfx::init();
bgfx::setViewClear(0, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x303030ff, 1.0f, 0);
bgfx::setViewRect(0, 0, 0, uint16_t(width), uint16_t(height));
bgfx::touch(0);
bgfx::frame();
Falcor:
Falcor::SampleApp::run(argc, argv, "My Falcor App");
mpCamera = Camera::create();
mpScene = Scene::create("MyScene");
mpRenderGraph = RenderGraph::create("MyRenderGraph");
renderFrame();
bgfx offers a more low-level approach with direct control over rendering states, while Falcor provides a higher-level abstraction with built-in scene management and render graph functionality. bgfx is more versatile across platforms, but Falcor offers easier implementation of advanced rendering techniques.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Falcor
Falcor is a real-time rendering framework supporting DirectX 12 and Vulkan. It aims to improve productivity of research and prototype projects.
Features include:
- Abstracting many common graphics operations, such as shader compilation, model loading, and scene rendering
- Raytracing support
- Python scripting support
- Render graph system to build modular renderers
- Common rendering techniques such post-processing effects
- Unbiased path tracer
- Integration of various RTX SDKs such as DLSS, RTXDI and NRD
Prerequisites
- Windows 10 version 20H2 (October 2020 Update) or newer, OS build revision .789 or newer
- Visual Studio 2022
- Windows 10 SDK (10.0.19041.0) for Windows 10, version 2004
- A GPU which supports DirectX Raytracing, such as the NVIDIA Titan V or GeForce RTX
- NVIDIA driver 466.11 or newer
Optional:
- Windows 10 Graphics Tools. To run DirectX 12 applications with the debug layer enabled, you must install this. There are two ways to install it:
- Click the Windows button and type
Optional Features
, in the window that opens clickAdd a feature
and selectGraphics Tools
. - Download an offline package from here. Choose a ZIP file that matches the OS version you are using (not the SDK version used for building Falcor). The ZIP includes a document which explains how to install the graphics tools.
- Click the Windows button and type
- NVAPI, CUDA, OptiX (see below)
Building Falcor
Falcor uses the CMake build system. Additional information on how to use Falcor with CMake is available in the CMake development documetation page.
Visual Studio
If you are working with Visual Studio 2022, you can setup a native Visual Studio solution by running setup_vs2022.bat
after cloning this repository. The solution files are written to build/windows-vs2022
and the binary output is located in build/windows-vs2022/bin
.
Visual Studio Code
If you are working with Visual Studio Code, run setup.bat
after cloning this repository. This will setup a VS Code workspace in the .vscode
folder with sensible defaults (only if .vscode
does not exist yet). When opening the project folder in VS Code, it will prompt to install recommended extensions. We recommend you do, but at least make sure that CMake Tools is installed. To build Falcor, you can select the configure preset by executing the CMake: Select Configure Preset action (Ctrl+Shift+P). Choose the Windows Ninja/MSVC preset. Then simply hit Build (or press F7) to build the project. The binary output is located in build/windows-ninja-msvc/bin
.
Warning: Do not start VS Code from Git Bash, it will modify the PATH
environment variable to an incompatible format, leading to issues with CMake.
Linux
Falcor has experimental support for Ubuntu 22.04. To build Falcor on Linux, run setup.sh
after cloning this repository. You also need to install some system library headers using:
sudo apt install xorg-dev libgtk-3-dev
You can use the same instructions for building Falcor as described in the Visual Studio Code section above, simply choose the Linux/GCC preset.
Configure Presets
Falcor uses CMake Presets store in CMakePresets.json
to provide a set of commonly used build configurations. You can get the full list of available configure presets running cmake --list-presets
:
$ cmake --list-presets
Available configure presets:
"windows-vs2022" - Windows VS2022
"windows-ninja-msvc" - Windows Ninja/MSVC
"linux-clang" - Linux Ninja/Clang
"linux-gcc" - Linux Ninja/GCC
Use cmake --preset <preset name>
to generate the build tree for a given preset. The build tree is written to the build/<preset name>
folder and the binary output files are in build/<preset name>/bin
.
An existing build tree can be compiled using cmake --build build/<preset name>
.
Falcor In Python
For more information on how to use Falcor as a Python module see Falcor In Python.
Microsoft DirectX 12 Agility SDK
Falcor uses the Microsoft DirectX 12 Agility SDK to get access to the latest DirectX 12 features. Applications can enable the Agility SDK by putting FALCOR_EXPORT_D3D12_AGILITY_SDK
in the main .cpp
file. Mogwai
, FalcorTest
and RenderGraphEditor
have the Agility SDK enabled by default.
NVAPI
To enable NVAPI support, head over to https://developer.nvidia.com/nvapi and download the latest version of NVAPI (this build is tested against version R535).
Extract the content of the zip file into external/packman/
and rename R535-developer
to nvapi
.
NSight Aftermath
To enable NSight Aftermath support, head over to https://developer.nvidia.com/nsight-aftermath and download the latest version of Aftermath (this build is tested against version 2023.1).
Extract the content of the zip file into external/packman/aftermath
.
CUDA
To enable CUDA support, download and install CUDA 11.6.2 or later and reconfigure the build.
See the CudaInterop
sample application located in Source/Samples/CudaInterop
for an example of how to use CUDA.
OptiX
If you want to use Falcor's OptiX functionality (specifically the OptixDenoiser
render pass) download the OptiX SDK (Falcor is currently tested against OptiX version 7.3) After running the installer, link or copy the OptiX SDK folder into external/packman/optix
(i.e., file external/packman/optix/include/optix.h
should exist).
Note: You also need CUDA installed to compile the OptixDenoiser
render pass, see above for details.
NVIDIA RTX SDKs
Falcor ships with the following NVIDIA RTX SDKs:
- DLSS (https://github.com/NVIDIA/DLSS)
- RTXDI (https://github.com/NVIDIAGameWorks/RTXDI)
- NRD (https://github.com/NVIDIAGameWorks/RayTracingDenoiser)
Note that these SDKs are not under the same license as Falcor, see LICENSE.md for details.
Resources
- Falcor: Falcor's GitHub page.
- Documentation: Additional information and tutorials.
- Rendering Resources A collection of scenes loadable in Falcor (pbrt-v4 format).
- ORCA: A collection of scenes and assets optimized for Falcor.
- Slang: Falcor's shading language and compiler.
Citation
If you use Falcor in a research project leading to a publication, please cite the project. The BibTex entry is
@Misc{Kallweit22,
author = {Simon Kallweit and Petrik Clarberg and Craig Kolb and Tom{'a}{\v s} Davidovi{\v c} and Kai-Hwa Yao and Theresa Foley and Yong He and Lifan Wu and Lucy Chen and Tomas Akenine-M{\"o}ller and Chris Wyman and Cyril Crassin and Nir Benty},
title = {The {Falcor} Rendering Framework},
year = {2022},
month = {8},
url = {https://github.com/NVIDIAGameWorks/Falcor},
note = {\url{https://github.com/NVIDIAGameWorks/Falcor}}
}
Top Related Projects
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.
One stop solution for all Vulkan samples
Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
Unity Graphics - Including Scriptable Render Pipeline
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot