Home

Awesome

DiligentSamples <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/diligentgraphics-logo.png" height=64 align="right" valign="middle">

This module contains tutorials and sample applications intended to demonstrate the usage of Diligent Engine. The module depends on the Core, Tools, and FX submodules.

To build and run the applications in the module, please follow the instructions in the master repository.

PlatformBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/windows-logo.png" width=24 valign="middle"> WindowsBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/uwindows-logo.png" width=24 valign="middle"> Universal WindowsBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/linux-logo.png" width=24 valign="middle"> LinuxBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/android-logo.png" width=24 valign="middle"> AndroidBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/macos-logo.png" width=24 valign="middle"> MacOSBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/apple-logo.png" width=24 valign="middle"> iOSBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/tvos-logo.png" width=24 valign="middle"> tvOSBuild Status
<img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/emscripten-logo.png" width=24 valign="middle"> EmscriptenBuild Status

License Chat on Discord Appveyor Build Status MSVC Code Analysis Lines of code

Table of Contents

Tutorials

Tutorial 01 - Hello Triangle

This tutorial shows how to render simple triangle using Diligent Engine API.

:arrow_forward: Run in the browser

Tutorial 02 - Cube

This tutorial demonstrates how to render an actual 3D object, a cube. It shows how to load shaders from files, create and use vertex, index and uniform buffers.

:arrow_forward: Run in the browser

Tutorial 03 - Texturing

This tutorial demonstrates how to apply a texture to a 3D object. It shows how to load a texture from file, create shader resource binding object and how to sample a texture in the shader.

:arrow_forward: Run in the browser

Tutorial 03 - Texturing-C

This tutorial is identical to Tutorial03, but is implemented using the C API.

Tutorial 03 - Texturing-DotNet

This tutorial demonstrates how to use the Diligent Engine API in .NET applications.

Tutorial 04 - Instancing

This tutorial demonstrates how to use instancing to render multiple copies of one object using unique transformation matrix for every copy.

:arrow_forward: Run in the browser

Tutorial 05 - Texture Array

This tutorial demonstrates how to combine instancing with texture arrays to use unique texture for every instance.

:arrow_forward: Run in the browser

Tutorial 06 - Multithreading

This tutorial shows how to generate command lists in parallel from multiple threads.

:arrow_forward: Run in the browser

Tutorial 07 - Geometry Shader

This tutorial shows how to use geometry shader to render smooth wireframe.

Tutorial 08 - Tessellation

This tutorial shows how to use hardware tessellation to implement simple adaptive terrain rendering algorithm.

Tutorial 09 - Quads

This tutorial shows how to render multiple 2D quads, frequently switching textures and blend modes.

:arrow_forward: Run in the browser

Tutorial 10 - Data Streaming

This tutorial shows dynamic buffer mapping strategy using MAP_FLAG_DISCARD and MAP_FLAG_DO_NOT_SYNCHRONIZE flags to efficiently stream varying amounts of data to GPU.

:arrow_forward: Run in the browser

Tutorial 11 - Resource Updates

This tutorial demonstrates different ways to update buffers and textures in Diligent Engine and explains important internal details and performance implications related to each method.

:arrow_forward: Run in the browser

Tutorial 12 - Render Target

This tutorial demonstrates how to render a 3d cube into an offscreen render target and do a simple post-processing effect.

:arrow_forward: Run in the browser

Tutorial 13 - Shadow Map

This tutorial demonstrates how to render basic shadows using a shadow map.

:arrow_forward: Run in the browser

Tutorial 14 - Compute Shader

This tutorial shows how to implement a simple particle simulation system using compute shaders.

:arrow_forward: Run in the browser

Tutorial 15 - Multiple Windows

This tutorial demonstrates how to use Diligent Engine to render to multiple windows.

Tutorial 16 - Bindless Resources

This tutorial shows how to implement bindless resources, a technique that leverages dynamic shader resource indexing feature enabled by the next-gen APIs to significantly improve rendering performance.

:arrow_forward: Run in the browser

Tutorial 17 - MSAA

This tutorial demonstrates how to use multisample anti-aliasing (MSAA) to make geometrical edges look smoother and more temporarily stable.

:arrow_forward: Run in the browser

Tutorial 18 - Queries

This tutorial demonstrates how to use queries to retrieve various information about the GPU operation, such as the number of primitives rendered, command processing duration, etc.

:arrow_forward: Run in the browser

Tutorial 19 - Render passes

This tutorial demonstrates how to use the render passes API to implement simple deferred shading.

:arrow_forward: Run in the browser

Tutorial 20 - Mesh Shader

This tutorial demonstrates how to use amplification and mesh shaders, the new programmable stages, to implement view frustum culling and object LOD calculation on the GPU.

Tutorial 21 - Ray Tracing

This tutorial demonstrates the basics of using ray tracing API in Diligent Engine.

Tutorial 22 - Hybrid Rendering

This tutorial demonstrates how to implement a simple hybrid renderer that combines rasterization with ray tracing.

Tutorial 23 - Command Queues

This tutorial demonstrates how to use multiple command queues to perform rendering in parallel with copy and compute operations.

Tutorial 24 - Variable Rate Shading

This tutorial demonstrates how to use variable rate shading to reduce the pixel shading load.

Tutorial 25 - Render State Packager

This tutorial shows how to create and archive pipeline states with the render state packager off-line tool on the example of a simple path tracer.

Tutorial 26 - Render State Cache

This tutorial expands the path tracing technique implemented in previous tutorial and demonstrates how to use the render state cache to save pipeline states created at run time and load them when the application starts.

:arrow_forward: Run in the browser

Tutorial 27 - Post-Processing

This tutorial demonstrates how to use post-processing effects from the DiligentFX module.

:arrow_forward: Run in the browser

Tutorial 28 - Hello OpenXR

This tutorial demonstrates how to use Diligent Engine with OpenXR API to render a simple scene in a VR headset.

Samples

Atmospheric Light Scattering sample

This sample demonstrates how to integrate Epipolar Light Scattering post-processing effect into an application to render physically-based atmosphere.

:arrow_forward: Run in the browser

GLFW Demo

This simple maze mini-game demonstrates how to use GLFW to create window and handle keyboard and mouse input.

GLTF Viewer

This sample demonstrates how to use the Asset Loader and GLTF PBR Renderer to load and render GLTF models.

:arrow_forward: Run in the browser

USD Viewer

This sample demonstrates how to render USD files using Hydrogent, an implementation of the Hydra rendering API in Diligent Engine.

Shadows

This sample demonstrates how to integrate the Shadowing component into an application to render high-quality shadows.

:arrow_forward: Run in the browser

Dear ImGui Demo

This sample demonstrates the integration of the engine with dear imgui UI library.

:arrow_forward: Run in the browser

Nuklear Demo

This sample demonstrates the integration of the engine with nuklear UI library.

Hello AR

This sample demonstrates how to use Diligent Engine in a basic Android AR application.

Asteroids

This sample is designed to be a performance benchmark and is based on this demo developed by Intel. It renders 50,000 unique textured asteroids. Every asteroid is a combination of one of 1000 unique meshes and one of 10 unique textures. The sample uses original D3D11 and D3D12 native implementations, and adds implementations using Diligent Engine API to allow comparing performance of different rendering modes.

Unity Plugin

This project demonstrates integration of Diligent Engine with Unity.

Build and Run Instructions

Please refer to Build and Run Instructions section in the master repository's readme.

Command line options:

When image capture is enabled the following hot keys are available:

To record multiple frames after the app starts, use command line like this:

--mode d3d12 --capture_path . --capture_fps 15 --capture_name frame --width 640 --height 480 --capture_format png --capture_frames 50

License

See Apache 2.0 license.

This project has some third-party dependencies, each of which may have independent licensing:

<a name="contributing"></a>

Contributing

To contribute your code, submit a Pull Request to this repository. Diligent Engine is licensed under the Apache 2.0 license that guarantees that content in the DiligentSamples repository is free of Intellectual Property encumbrances. In submitting any content to this repository, you license that content under the same terms, and you agree that the content is free of any Intellectual Property claims and you have the right to license it under those terms.

Diligent Engine uses clang-format to ensure consistent source code style throughout the code base. The format is validated by CI for each commit and pull request, and the build will fail if any code formatting issue is found. Please refer to this page for instructions on how to set up clang-format and automatic code formatting.


diligentgraphics.com

Diligent Engine on Twitter Diligent Engine on Facebook