Diligent Samples Documentation

repository·master·Indexed 19 days ago

https://github.com/diligentgraphics/diligentsamples

A 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.

Tokens
72.4K
Snippets
161
Records
235
Agent score
64%

What's inside Diligent Samples

  1. Overview of Order-Independent Transparency (OIT) in Diligent Engine

    master

    Order-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:

    1. Unsorted alpha-blending: A baseline method used to demonstrate the visual artifacts that occur when sorting is omitted.
    2. Weighted-blended OIT: An efficient approximation that assigns weights to surfaces based on depth and transparency.
    3. Layered OIT: A more advanced approach for handling transparency layers.
  2. Explore Diligent Engine Tutorials

    master
    The diligentsamples repository 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.
  3. Use Diligent Engine in an Android AR application

    master
    The Hello AR sample provides a demonstration of integrating Diligent Engine into a basic Android Augmented Reality (AR) application. This sample is adapted from the official Google ARCore hello_ar_c sample from the ARCore Android SDK, showing how to leverage Diligent Engine's rendering capabilities within an AR environment.
  4. Implement a particle simulation with Compute Shaders

    master
    This 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.
  5. What is a Geometry Shader and how is it used for wireframes

    master

    A 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:

    1. Computing the triangle area.
    2. Determining the distance from every vertex to its opposite edge.
    3. 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 );
    }
  6. What is Diligent Render State Notation?

    master
    The Diligent Render State Notation is 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.