Background
Nvidia’s MDL is a shading language that describes material’s behaviour against light rays.
It is quite popular among certain user base which depends on Iray renderer (since Iray uses MDL).
e.g. Daz Studio users
After having discussed with Daz users in online forums, they showed enthusiastic interest in the potential ability to render MDL materials in Blender Cycles.
Since then, I have been researching for a month now on how to make code changes to Cycles in order to render MDL materials that look very close or idential to Iray renders using equivalent MDL materials.
This topic is to discuss what would be the best way to make this code change to Cycles.
Code change to the following sections in Cycles codebase.
The following changes will have to be made within Cycles:
BSDF evaluation code
BSDF sampling code
A custom open sourced Blender build. It is unclear at this point whether it’s possible to gracefully integrate MDL support without tempering with Cycles’ intended functionalities. Therefore, code changes will be released as a custom Blender build for the time being.
Device support:
This change will rely on MDL SDK to compile the MDL script into executable shader bytecodes. Currently, MDL SDK only supports the following backends:
CUDA
CPU (LLVM-IR or x86_64)
HLSL
GLSL (experimental)
Therefore, MDL support in Cycles will be limited to following device backends:
I would rather focus on improving our built-in BSDFs to add some functionality that is available in MDL, and see work done for better material I/O. We still can do so much better in those areas, that investing time in MDL seems like the wrong priority right now.
The important use case is also a bit unclear to me. If MDL becomes more of an interchange standard it could make sense to bet on this, but it’s not clear that is happening. And in that case I would expect the emphasis would be more on authoring MDL materials and exporting, since that’s where Blender typically fits in the pipeline. And that has implications for the user interface, a script node is not very user friendly for authoring.
MDL does not work on all devices which immediately makes it something that few users will rely on. Such materials can’t be shared as easily so similar to OSL it might not get much attention in tutorials and material libraries because of that.
So at the moment I’m not convinced that the code complexity and maintenance cost will be worth it and I would likely reject a patch for MDL. It would slow us down too much when we want to make more important changes, as happened with OSL.
Just a side note, the reason why we don’t pay too much attention to OSL in tutorials is that it just works with CPU, as soon as it’s working in GPU too I assure you that we will use it extensively! But right now using OSL is limiting ourselves to CPU rendering, something we rather prefer to avoid
About MDL I agree with you, as an extreme situation I would rather prefer to have an option in the principled shader that enables the MDL shading mode, but it works as transparent as possible to the user, that way a fallback to normal principled would be easy for OpenCL users, but I agree that features should have to be added in general both for MDL and normal shading, at least for principled
For what it’s worth, to me it seems that Material-X seems will be the emerging standard. We’ve been testing Houdini 18 with its USD based workflow and Materal-X is the main (external) format for material interchange that it supports. It’s also supported by Clarisse which is also working on USD. Arnold and Renderman support it, Not to mention, Pixar is working to integrate material-X into USD natively. So, I’m expecting the future to be USD and Material-X. Another cool thing is that Material-X is based on a node graph so it might be easier to translate directly into and from Cycles/Eevee graphs.