Diligent Samples Documentation
repository·master·Indexed 19 days ago
https://github.com/diligentgraphics/diligentsamplesA collection of educational tutorials and practical applications for the Diligent Engine. It covers graphics programming from basic triangle rendering to advanced topics including Ray Tracing, Mesh Shaders, Bindless Resources, and Compute Shaders. The repository includes integration examples for Android AR, visionOS, OpenXR, and Unity, as well as performance benchmarks like the Asteroids sample and tools for pipeline state management.
What's inside Diligent Samples
- The GLTF Viewer sample demonstrates the integration of the Asset Loader and the GLTF PBR Renderer to load and render GLTF models. It supports Physically Based Rendering (PBR) and can be run directly in a web browser via WebAssembly.
Overview of Diligent Samples
masterDiligent Samples is a collection of tutorials and sample applications designed to demonstrate the usage of the Diligent Engine.
This module depends on the following submodules:
- Core
- Tools
- FX
It provides practical examples ranging from basic triangle rendering to advanced topics like Ray Tracing, Bindless Resources, and Compute Shaders.
Overview of Order-Independent Transparency (OIT) in Diligent Engine
masterOrder-Independent Transparency (OIT) is a set of techniques used to render transparent objects without requiring them to be sorted by depth. Standard alpha-blending is non-commutative, meaning the rendering order affects the final pixel color. While depth-sorting objects is a common workaround, it fails when objects intersect, are nested, or have complex self-overlapping geometry. OIT methods allow these objects to be rendered in any order while maintaining visual correctness.
This tutorial demonstrates three specific approaches:
- Unsorted alpha-blending: A baseline method used to demonstrate the visual artifacts that occur when sorting is omitted.
- Weighted-blended OIT: An efficient approximation that assigns weights to surfaces based on depth and transparency.
- Layered OIT: A more advanced approach for handling transparency layers.
Integrate Dear ImGui with the Diligent engine
masterTheImguiDemosample demonstrates how to integrate the dear imgui UI library with the Diligent engine. This allows you to build graphical user interfaces (GUIs) that run on top of your graphics application.Explore Diligent Engine Tutorials
masterThediligentsamplesrepository contains a comprehensive suite of tutorials designed to teach various graphics programming techniques using the Diligent Engine. Tutorials range from basic geometry rendering to advanced topics like Ray Tracing and Mesh Shaders. Many tutorials are available to run directly in the browser via WebAssembly.Use Diligent Engine in an Android AR application
masterTheHello ARsample provides a demonstration of integrating Diligent Engine into a basic Android Augmented Reality (AR) application. This sample is adapted from the official Google ARCorehello_ar_csample from the ARCore Android SDK, showing how to leverage Diligent Engine's rendering capabilities within an AR environment.Integrate Nuklear UI with the engine
masterThe Nuklear Demo sample demonstrates how to integrate the nuklear immediate-mode UI library with the Diligent engine.
Platform Limitation: Note that input event handling for this specific sample is only implemented for the Win32 platform.
Use post-processing effects from DiligentFX
masterThis tutorial demonstrates how to integrate a post-processing stack into your project using theDiligentFXmodule. The implementation follows a deferred lighting pipeline consisting of several distinct render passes to achieve the final image.Implement a particle simulation with Compute Shaders
masterThis tutorial demonstrates how to build a GPU-accelerated particle simulation system using compute shaders. The system simulates spherical particles undergoing elastic collisions. To maintain $O(n)$ complexity, the shader uses a spatial binning approach: the screen is subdivided into bins, and each bin maintains a list of particles residing within it. Collision detection is then limited to particles within the same or neighboring bins.Use the Atmospheric Light Scattering sample
masterThe Atmospheric Light Scattering sample demonstrates how to integrate the Epipolar Light Scattering post-processing effect into an application to render a physically-based atmosphere. This is useful for developers looking to implement realistic atmospheric lighting and scattering effects using DiligentFX.What is a Geometry Shader and how is it used for wireframes
masterA Geometry Shader is a programmable stage that resides between the vertex shader and the pixel shader (or between the domain shader and pixel shader when using hardware tessellation). Unlike vertex shaders which process individual vertices, the geometry shader operates on full primitives (e.g., entire triangles).
In this tutorial, the geometry shader is used to render a smooth wireframe by:
- Computing the triangle area.
- Determining the distance from every vertex to its opposite edge.
- Passing these distances to the pixel shader via interpolation, allowing the pixel shader to compute the distance to the closest edge and render a line based on that distance.
[maxvertexcount(3)] void main(triangle VSOutput In[3], inout TriangleStream<GSOutput> triStream ) { // ... logic to compute area and distances to edges ... triStream.Append( Out ); }What is Diligent Render State Notation?
masterTheDiligent Render State Notationis a JSON-based render state description language used by the Render State Packager tool. It allows developers to define pipeline states, shaders, and pipeline resource signatures in a structured format. This notation is then processed by the packager to produce an archive that can be loaded directly into the Diligent Engine at run-time without further processing.