Home

Awesome

An introduction to the NVIDIA MDL SDK

The NVIDIA® Material Definition Language (MDL) SDK is an open source set of tools that enable the integration of physically-based materials into rendering applications.

Preface

This README introduces the MDL SDK. It describes the target audience, the purpose of the SDK, an example workflow and running example programs that illustrate the implementation of core MDL concepts.

Related information:

Audience

Software developers responsible for integrating MDL into applications with 2D or 3D graphics capabilities.

Prerequisite skills:

What is MDL?

Material definition language

NVIDIA Material Definition Language (MDL) is a domain-specific programming language that you use to define physically-based materials and lights for rendering. It is designed for the definition of the highest quality materials, fast rendering, and serves as an industry standard for material exchange.

Figure 1. MDL example material renderings

MDL materials

Materials consist of two parts -- A material definition and functions:

Related information: For detailed information about MDL, the underlying concepts, and creating MDL materials, see the MDL documentation.

What is the MDL SDK?

The following sections describe the purpose of the MDL SDK, an example workflow supported by the SDK, and a link to the installation instructions.

Purpose

The MDL SDK is a toolkit delivered as an open source C++ library. It is designed to support a wide range of material workflows in new or existing applications.

Example usage

The following figure illustrates an example workflow for material creation:

Figure 2. Example of a material workflow supported by the MDL SDK

The callouts in the figure are described below. Each callout describes how a specific SDK component supports this material workflow:

  1. MDL modules: You use the module mechanism to package materials and functions for re-use. An MDL module contains one or more material and function definitions. When you load a module it is parsed and validated by the MDL compiler and its content is stored in an internal database.

  2. Internal database: The internal database provides access to all material and function definitions.

  3. Transactions and call graphs: You create, edit, and store material instances and function calls using transactions. The results are stored in the internal database. From database entities, you can connect functions to material parameters and build call graphs that express complex materials.

  4. Compiled materials: You can compile these graphs into a compact optimized representation, which is referred to as a compiled material. The compilation step includes inlining of call expressions, constant folding and the elimination of common subexpressions.

  5. Distilling and texture baking: Distilling is a process for mapping or simplifying compiled MDL materials to more limited material models used by specific renderers.

  6. Texture baking: Baking textures ensures optimal rendering performance for game engines.

  7. Back ends: A compiled material is the basis for code generation. The SDK provides the following backends for code generation:

    • CUDA PTX
    • LLVM 12 IR
    • HLSL and GLSL
    • Native code generation for the CPU

The SDK also provides:

Installing the SDK

Installations for the MDL SDK are provided for Linux, Windows, and macOS. See "Building the MDL SDK from Source" for system requirements and installation instructions.

Getting started using the SDK

To help you get up to speed quickly, the MDL SDK provides many example programs that you can use as a starting point for the integration of MDL into your application. The example programs are organized under "The basics", which covers concepts and implementation details that all software developers need to understand, followed by concepts and implementation details concerning the integration of MDL into a renderer.

The basics

The example programs listed in this section take you through the following steps:

Examples:

Integrating MDL into a renderer

The example programs listed in this section take you through the following steps:

Compiling and executing functions

The example programs listed in this section describe the execution of code generated for various backends and execution of material expressions:

Examples:

Compiling and executing materials

The example programs listed in this section take you through the following steps:

Examples:

Distilling and baking

Distilling and baking enable you to optimize MDL materials for game engines and renderers with limited capabilities. The following examples provide an introduction to the MDL distilling mechanism and how to use it.

Examples:

Other topics

The following examples cover topics and use cases that may be important to your particular MDL integration.

Examples:

Additional resources