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.
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
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:
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
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.
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.
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:
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!
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