Where to find a demo?

Hello,
I was intrigued by the GTC 2024 talk “Sharing Physically Based Materials in OpenUSD” and noticed a “DXR Sample Path-tracer” being mentioned. Is this available for download anywhere, ideally prebuilt?
I’d like to try out MDL on my own.

Thanks!

Hi Limeth!

Welcome to our forum! We’re happy to hear you liked the talk!

You can download the MDL SDK on our website: MDL SDK | NVIDIA Developer → Get Started

The Windows / Linux / Mac download contains the prebuilt libraries, but you need to build the examples yourself.
You can find instructions how to build them at Getting Started.
By disabling some MDL* options in CMake, you can reduce the number of required dependencies.
The “DXR Sample Path-tracer” example is located under “examples” → “mdl_sdk” → “dxr”.

If you want to try out different MDL materials, you can download a big and free MDL material catalog here: vMaterials | NVIDIA Developer

If you have any more questions, feel free to ask!

Best regards
Moritz

Here are a few GLTF scenes a colleague recommended to see something more interesting than just a sphere:

https://sketchfab.com/3d-models/material-ball-in-3d-coat-a6bdf1d11d714e07b9dd99dda02de965

https://sketchfab.com/3d-models/rock-jacket-mid-poly-25711a832a344c2dbe0b592c9d98707b

https://sketchfab.com/3d-models/mando-helmet-9da2e7fc67de443e95e190fc0c29f0c7

https://sketchfab.com/3d-models/senua-fd560f8d33ed4d09be36f691b928e6ad

The MDL SDK DXR example uses an MDL implementation of the GLTF material model. But MDL can be used to implement different and more complex materials as well. The example is able to render those, too.

Thanks for the quick response. I have been trying to compile the examples, but I am currently stuck on CMake GUI not being able to find the glfw3 library installed through vcpkg:

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
[INFO] MDL_BASE_FOLDER:                      D:/data/Knihovny/mdl-sdk-373000.3036
[INFO] MDL_INCLUDE_FOLDER:                   D:/data/Knihovny/mdl-sdk-373000.3036/include
[INFO] MDL_SRC_FOLDER:                       D:/data/Knihovny/mdl-sdk-373000.3036
[INFO] MDL_EXAMPLES_FOLDER:                  D:/data/Knihovny/mdl-sdk-373000.3036/examples
[INFO] MDL_LOG_PLATFORM_INFOS:               ON
[INFO] MDL_LOG_DEPENDENCIES:                 ON
[INFO] MDL_LOG_FILE_DEPENDENCIES:            OFF
[INFO] MDL_TREAT_RUNTIME_DEPS_AS_BUILD_DEPS: ON
[INFO] MDL_ADDITIONAL_COMPILER_OPTIONS:      
[INFO] CMAKE_VERSION:                        3.27.2
[INFO] CMAKE_SYSTEM_NAME:                    Windows
[INFO] CMAKE_SYSTEM_PROCESSOR:               AMD64
[INFO] WINDOWS:                              TRUE
[INFO] LINUX:                                FALSE
[INFO] MACOSX:                               FALSE
[INFO] ARCH_ARM:                             FALSE
[INFO] ARCH_X64:                             TRUE
[INFO] MI_PLATFORM_NAME:                     nt-x86-64
[INFO] CMAKE_BUILD_TYPE:                     
[INFO] CMAKE_GENERATOR:                      Visual Studio 17 2022
[INFO] GENERATOR_IS_MULTI_CONFIG:            1
[INFO] CMAKE_CXX_COMPILER_ID:                MSVC
[INFO] CMAKE_CXX_COMPILER_VERSION:           19.38.33135.0
[INFO] CMAKE_CXX_COMPILER:                   C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
[INFO] MSVC_VERSION:                         1938
[INFO] MSVC_IDE:                             1
[INFO] CMAKE_CXX_FLAGS:                      /DWIN32 /D_WINDOWS /W3 /GR /EHsc
[INFO] CMAKE_CXX_FLAGS_DEBUG:                 /Zi /Ob0 /Od /RTC1
[INFO] CMAKE_CXX_FLAGS_RELEASE:               /O2 /Ob2 /DNDEBUG
[INFO] CMAKE_CXX_FLAGS_RELWITHDEBINFO:        /Zi /O2 /Ob1 /DNDEBUG
[INFO] CMAKE_EXE_LINKER_FLAGS:               /machine:x64
[INFO] CMAKE_TOOLCHAIN_FILE:                 D:/data/Knihovny/vcpkg/scripts/buildsystems/vcpkg.cmake
[INFO] VCPKG_TARGET_TRIPLET:                 x64-windows-static
[INFO] Qt5_DIR:                              
[INFO] CMAKE_CUDA_COMPILER:                  
[INFO] PYTHON_DIR:                           
[INFO] python_PATH:                          
[INFO] clang_PATH:                           
[INFO] swig_PATH:                            
[INFO] ARNOLD_SDK_DIR:                       
[INFO] MATERIALX_DIR:                        
[INFO] SLANG_DIR:                            
[INFO] OPTIX7_DIR:                           
[INFO] CUDA8_PATH:                           
[INFO] PANTORA_AXF_DIR:                      
[INFO] VULKAN_SDK_DIR:                       
[INFO] DXC_DIR:                              
[INFO] DOXYGEN_DIR:                          
[INFO] GRAPHVIZ_DIR:                         
Found CUDA using the compiler.
[INFO] MDL_DEPENDENCY_CUDA_INCLUDE:          C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin/../include;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin/../curand_dev/include
[INFO] MDL_DEPENDENCY_CUDA_LIBS:             C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin/../lib/x64/cuda.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin/../lib/x64/cudart.lib
[INFO] MDL_DEPENDENCY_CUDA_SHARED:           
[INFO] CMAKE_CUDA_COMPILER_ID:               NVIDIA
[INFO] CMAKE_CUDA_COMPILER_VERSION:          12.2.128
[INFO] CMAKE_CUDA_COMPILER:                  C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin/nvcc.exe
_GLFW_INCLUDE: 
_GLFW_LIB: 
CMake Error at cmake/find/find_glfw_ext.cmake:20 (message):
  The dependency "glfw" could not be resolved.  Please specify
  'CMAKE_TOOLCHAIN_FILE'.  Alternatively, you can disable the options
  'MDL_ENABLE_OPENGL_EXAMPLES' and 'MDL_ENABLE_VULKAN_EXAMPLES'.
Call Stack (most recent call first):
  cmake/setup.cmake:278 (find_glfw_ext)
  CMakeLists.txt:58 (include)


Configuring incomplete, errors occurred!

I have followed these installation instructions specific to the SDK version I downloaded.
I installed vcpkg by cloning the github repo and checking out the specified commit, then running the initialization .bat file.
Then I ran ..\vcpkg\vcpkg.exe install --triplet=x64-windows-static boost-any boost-uuid openimageio[gif,openjpeg,tools,webp] glew glfw3 from within the mdl-sdk directory.
I created a build subdirectory in the mdl-sdk directory, and I tried configuring CMake on it through CMake GUI version 3.27.2, and I got this error.
I tried updating the CMAKE_TOOLCHAIN_FILE option as instructed by the compilation guide, to no avail.
The log contains the output after all of these steps.

Would you happen to know what this might be caused by? @mkroll

Best regards,
Limeth

Thanks a lot for the detailed problem report and sorry for the inconvenience!

I can reproduce your problem. For the open-source version this works… We will fix that.
For now, you can workaround this problem by deleting your CMake cache, then adding the CMAKE_TOOLCHAIN_FILE filepath option via “Add Entry” and then clicking on “Configure”.

Btw, openimageio is only needed for the open-source version. The other build instructions I posted above (Getting Started) don’t mention it.

Best regards
Moritz

1 Like

Thanks, that worked for me. I got the DXR example working, but I am a bit confused about how I would change the MDL material of the sphere. Under Material → Assign new material, I could not find any MDLE files in the default vMaterials installation dir in Documents\mdl, only MDL.
I tried using the MDL Browser example to see if I could get some vMaterials’ names ::this::format, but no vMaterials showed up. It seem that only the “components” out of which actual vMaterials would be made of showed up.

Only MDLE files can be selected via a file path as they are fully self-contained. MDL files have to be present in your MDL search path.
Most examples use the default search paths, specified in https://raytracing-docs.nvidia.com/mdl/specification/MDL_spec_1.8.2_24May2023.pdf#chapter.27
But you can also manually add search paths via command line options or via API.

If you start the DXR example, after you have built the MDL Browser example, you will be able to “Assign new material” also via the MDL Browser by clicking on “browse…” in the opened dialog.

In your case, this should not be necessary though, as the Documents\mdl path is used by the DXR example and the MDL Browser example. So in the Package Explorer, you should see a “vMaterials_2” folder.

Can you please verify that:

  • the console opened with the MDL Browser example shows your Documents\mdl path as an MDL Module Path
  • the file ...\Documents\mdl\vMaterials_2\Metal\Brass_Hammered.mdl exists
  • in the DXR example, entering ::vMaterials_2::Metal::Brass_Hammered::Brass_Hammered as qualified name in “Assign new material” works

Please also look for any error messages in the consoles of the examples.

Looks like the Documents\mdl directory is not included, as this is in the log when running the DXR example (I found no such output in the MDL Browser example):

[13:24:57] [MDL_D3D12] [INFO]    Search paths used in the following order:
                      - C:\ProgramData\NVIDIA Corporation\mdl\
                      - D:\data\Knihovny\mdl-sdk-373000.3036\examples\mdl_sdk\shared\..\..\mdl
                      - D:\data\Knihovny\mdl-sdk-373000.3036\build\examples\mdl_sdk\dxr\RelWithDebInfo\content\gltf\sphere

That’s pretty strange, because it seems that the MDL_USER_PATH env var is set in the Windows dialog:


I wonder if either Visual Studio is ignoring the user env vars, or the examples are unable to parse the ř character in the path?

It is very likely caused by the ř character in the path. I tried adding the MDL_USER_PATH to the MDL_SYSTEM_PATH, with no luck. Then I tried copying the MDL_USER_PATH directory to D:\data\Knihovny\mdl, added it to the MDL_SYSTEM_PATH variable, and it works now.

At last, I can see MDL materials in their full glory! Thank you for the guidance!

Thanks for your detailed input on the problem!

The problem is that we use getenv() to read the environment variables. But this converts the ‘ř’ to a ‘r’. As the converted path does not exist, it is not added to the search path.

If you remove the environment variable (which is available, so you can easily change the paths), it falls back to using SHGetKnownFolderPath() which provides the correct unaltered path.

We will fix this issue in a next release.

Thank you for your patience and enjoy the MDL materials :D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.