Skip to content

Commit 0bcb415

Browse files
committed
MDL SDK 2023.0.4 (367100.4957)
1 parent 1902497 commit 0bcb415

File tree

115 files changed

+3473
-2863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3473
-2863
lines changed

CHANGELOG.md

+75
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
Change Log
22
==========
3+
MDL SDK 2023.0.4 (367100.4957): 05 Oct 2023
4+
-----------------------------------------------
5+
6+
7+
ABI compatible with the MDL SDK 2023.0.4 (367100.4957) binary release
8+
(see [https://developer.nvidia.com/mdl-sdk](https://developer.nvidia.com/mdl-sdk))
9+
10+
**Added and Changed Features**
11+
12+
- General
13+
- Python Bindings:
14+
- Added binding for the (built-in) entity resolver and added unit tests.
15+
- Accessing functions of invalid interfaces do not crash anymore but
16+
instead throw python exceptions.
17+
- Added more unit tests.
18+
- Extend the wrapper around MDL type (`Type`):
19+
- Give access to vectors and arrays size and element type.
20+
- Give access to matrices size.
21+
- Convert low level `IValues` to python friendly data types:
22+
- Extended to give access to file path for textures, light profiles
23+
and BSDF measurements.
24+
25+
- MDL SDK examples
26+
- Example DXR:
27+
- Reduced the HLSL glue code and added dynamic function selection
28+
for generated shader functions.
29+
- Added support for backface scattering and emission.
30+
- Handle `meters_per_scene_unit` at runtime and expose the parameter to the UI.
31+
- MaterialX resource resolution now uses the MDL entity resolver as fallback
32+
to handle tiled resources.
33+
- Handle the collapse flag of the `in_group` annotations.
34+
- Improved measured BSDF runtime implementation numerically.
35+
- Camera pose fitting now sets near and far plane distances.
36+
- Added support for `KHR_materials_iridescence` glTF extension.
37+
- Example Traversal:
38+
- Removed the preprocessor directive that disabled the distiller option.
39+
40+
**Fixed Bugs**
41+
42+
- General
43+
- Catch memory allocation failures in the OpenImageIO plugin while exporting images.
44+
- Python Bindings: Fixed the mdl_distiller plugin path in the scripts for
45+
running the examples.
46+
- Argument expressions that are created by the API are no longer optimized by the MDL
47+
compiler, but stay "unmodified" until arguments in class compilation mode are created.
48+
This makes the generated arguments more "deterministic" for users.
49+
- Fixed export of uv-tile textures. Only first tile was exported.
50+
- Fixed export of animated textures when frame number differs from frame ID.
51+
52+
- MDL Compiler and Backends
53+
- Fixed translation of vector access with non-constant index in some cases for HLSL/GLSL.
54+
- Fixed bit-operations on integer fields in structs containing derivable values.
55+
- HLSL/GLSL: The compiler uses now name mangling on struct types instead of
56+
the very simple old connection with '_'.
57+
- Fixed bug that caused crashes when several MDL modules import each other
58+
within a special order.
59+
- Material expressions which path prefix is "`geometry.displacement`" are now created in
60+
the displacement context.
61+
- Fixed code generation for re-exported MDL entities.
62+
- Fixed parsing of resource sets inside container files (MDLE).
63+
- Fixed ownership of types in created distribution functions which could lead to crashes
64+
under certain complex conditions.
65+
- Fixed crashes due to "missing functions" which are requested from wrong modules,
66+
for instance `state::cos()`.
67+
- Fixed printing of package name components which are MDL keywords and require
68+
quoting as Unicode identifiers.
69+
70+
- MDL SDK examples
71+
- Example DXR:
72+
- Fixed the UI parameter mapping for struct parameters.
73+
- Reviewed the UV coordinate handling and improved its documentation.
74+
- Added missing out of bounds check when reading `NV_materials_mdl` nodes.
75+
- Treat alpha channels in glTF textures as linear in cases where the RGB data
76+
is in sRGB color space.
77+
378
MDL SDK 2023.0.2 (367100.3997): 01 Aug 2023
479
-----------------------------------------------
580

INSTALL.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the examples.
1818
The build with the following 64-bit platform-compiler combinations has been
1919
successfully tested:
2020

21-
- **Windows 10:** Microsoft Visual Studio 2017 (msvc v141) or 2019 (msvc v142)
21+
- **Windows 10:** Microsoft Visual Studio 2019 (msvc v142)
2222
- **CentOS 7, Debian 11:** GCC 7 or GCC 10 (on x86-64 or aarch64)
2323
- **Mac OS X 12.6:** Xcode 12.4 (Apple Clang 12.0.0)
2424

@@ -52,6 +52,17 @@ The following third-party libraries and tools are required to build the MDL SDK:
5252
- **OpenImageIO** *(2.4.5)*
5353
Installation via [vcpkg](#vcpkg) is strongly recommended. Install the vcpkg
5454
package *openimageio*.
55+
Since the release of the above vcpkg version, the hash of the source code
56+
archive on GitHub has changed (the name of the top-level directory inside
57+
the archive changed).
58+
Thus you need to patch the SHA512 argument to *vcpkg_from_github()* near
59+
the beginning of the file *ports/openimageio/portfile.cmake* in the vcpkg
60+
directory to:
61+
62+
REF v${VERSION}
63+
SHA512 3d42d266d69119bf48f69b053948b4218d29c99f9a58007d24b0df0e4d111abbec26d65629b9754a868e33c5c00d2425de241368f1bf20182f5c7a96c0acb56f
64+
HEAD_REF master
65+
5566
Linux: Alternatively, install the *libopenimageio-dev* package from your
5667
native package manager. Do **not** mix packages for Boost (see previous
5768
item) and OpenImageIO from your native package manager and from vcpkg.
@@ -199,12 +210,12 @@ features.
199210
binaries.
200211

201212
It is recommended that you build into a subdirectory, not into the repository root.
202-
*C:/projects/mdl-sdk/build/vs2017* for example is fine, assuming you cloned the repository to:
213+
*C:/projects/mdl-sdk/build/vs2019* for example is fine, assuming you cloned the repository to:
203214

204215
C:/projects/mdl-sdk
205216

206217
3. After clicking ``Configure``, CMake asks you to choose the Generator.
207-
Select `Visual Studio 15 2017` (or higher), enter `host=x64` as toolset
218+
Select `Visual Studio 16 2019` (or higher), enter `host=x64` as toolset
208219
and click `Finish`. CMake starts to configure the build and stops several
209220
times when user input is required to resolve dependencies.
210221

cmake/dependencies/add_llvm.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ set(_LLVM_LIB_NAMES
8989
LLVMOption
9090
LLVMOrcJIT
9191
LLVMOrcShared
92+
LLVMOrcTargetProcess
9293
LLVMProfileData
9394
LLVMRemarks
9495
LLVMRuntimeDyld

doc/base_module/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ <h3>Edge</h3>
169169

170170
</div><div id="blackfooter">
171171
<span class="footeritem">
172-
31&#160;July&#160;2023,&#160;20:08,&#160;r367100.3997, v1.3
172+
26&#160;September&#160;2023,&#160;20:08,&#160;r367100.4957, v1.3
173173
</span>
174174
<span class="footeritem">
175175
<a href="https://www.nvidia.com/en-us/about-nvidia/legal-info/">&copy; 2023 NVIDIA&nbsp;Corporation.</a> All rights reserved.

doc/build/doxygen_footer.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- start footer part -->
33
<!--BEGIN GENERATE_TREEVIEW-->
44
<div id="nav-path">
5-
<span class="footeritem">MDL SDK 2023.0.2 (367100.3997): $datetime</span>
5+
<span class="footeritem">MDL SDK 2023.0.4 (367100.4957): $datetime</span>
66
<span class="footeritem">
77
<a href="http://www.nvidia.com/">
88
&copy;&#160;2023&#160;NVIDIA&#160;Corporation.</a>

doc/core_definitions/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ <h2>Page cannot be loaded</h2>
202202
bottom of the page or from the following links:</p>
203203

204204
<div style="padding-left:2em;">
205-
<a href="mdl_core_definitions.230731.A4.pdf">View documentation in A4 format</a><br>
206-
<a href="mdl_core_definitions.230731.LTR.pdf">View documentation in US Letter format</a><br>
205+
<a href="mdl_core_definitions.230926.A4.pdf">View documentation in A4 format</a><br>
206+
<a href="mdl_core_definitions.230926.LTR.pdf">View documentation in US Letter format</a><br>
207207
</div>
208208
<h3>Overriding security settings</h3>
209209

@@ -277,7 +277,7 @@ <h3>Edge</h3>
277277
<span class="footeritem">
278278
</span>
279279
<span class="footeritem">
280-
31&#160;July&#160;2023,&#160;20:09,&#160;r367100.3997, v1.4
280+
26&#160;September&#160;2023,&#160;20:09,&#160;r367100.4957, v1.4
281281
</span>
282282
<span class="footeritem">
283283
<a href="https://www.nvidia.com/en-us/about-nvidia/legal-info/">&copy; 2023 NVIDIA&nbsp;Corporation.</a> All rights reserved.

doc/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</div>
6262
<div id="blackfooter">
6363
<span class="footeritem">
64-
MDL SDK 2023.0.2 (367100.3997): 01 Aug 2023
64+
MDL SDK 2023.0.4 (367100.4957): 05 Oct 2023
6565
</span>
6666
<span class="footeritem">
6767
<a href="http://www.nvidia.com/">&copy;&#160;2023&#160;NVIDIA&#160;Corporation.</a> &#160;All&#160;rights&#160;reserved.

doc/mdl_sdkapi/getting_started.dox

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The example source code requires a C++17 compiler. Some examples require additio
7979
The build with the following x64-platform-compiler combinations has been
8080
successfully tested:
8181

82-
- **Windows 10:** Microsoft Visual Studio 2017 (msvc v141) or 2019 (msvc v142)
82+
- **Windows 10:** Microsoft Visual Studio 2019 (msvc v142)
8383
- **CentOS 7, Debian 11**: GCC 7 or GCC 10 (on x86-64 or aarch64)
8484
- **Mac OS X 12.6:** Xcode 12.4 (Apple Clang 12.0.0)
8585

@@ -193,12 +193,12 @@ features.
193193
example binaries.
194194

195195
It is recommended that you build into a subdirectory, not into the example root.
196-
C:/projects/mdl-sdk/examples/build/vs2017 for example is fine, assuming you extracted the mdl-sdk to:
196+
C:/projects/mdl-sdk/examples/build/vs2019 for example is fine, assuming you extracted the mdl-sdk to:
197197

198198
C:/projects/mdl-sdk
199199

200200
3. After clicking ``Configure``, CMake asks you to choose the
201-
Generator. Select `Visual Studio 15 2017` (or higher) and click
201+
Generator. Select `Visual Studio 16 2019` (or higher) and click
202202
`Finish`. CMake starts to configure the build and stops several
203203
times when user input is required to resolve dependencies.
204204

examples/mdl/nvidia/sdk_examples/gltf_support.mdl

+87-10
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export material gltf_material(
379379
// KHR_materials_ior
380380
uniform float ior = 1.5
381381
[[
382-
anno::hard_range(1.00, 5.0),
382+
anno::soft_range(1.0, 5.0),
383383
anno::in_group("Metallic Roughness"),
384384
anno::display_name("IOR"),
385385
anno::description("The index of refraction.")
@@ -474,6 +474,50 @@ export material gltf_material(
474474
anno::enable_if("clearcoat_factor>0.0")
475475
]],
476476

477+
// KHR_materials_iridescence
478+
uniform float iridescence_factor = 0.0
479+
[[
480+
anno::hard_range(0.0, 1.0),
481+
anno::in_group("Iridescence"),
482+
anno::display_name("Iridescence Factor"),
483+
anno::description("Strength of the iridescence. Multiplied to the 'Iridescence Texture' if available.")
484+
]],
485+
gltf_texture_lookup_value iridescence_texture = gltf_texture_lookup()
486+
[[
487+
anno::in_group("Iridescence"),
488+
anno::display_name("Iridescence Texture"),
489+
anno::description("Strength of the iridescence. Uses only the red channel, assuming linear space. Influenced by the 'Iridescence Factor'."),
490+
anno::enable_if("iridescence_factor>0")
491+
]],
492+
uniform float iridescence_ior = 1.3
493+
[[
494+
anno::soft_range(1.0, 5.0),
495+
anno::in_group("Iridescence"),
496+
anno::display_name("Iridescence IOR"),
497+
anno::description("The index of refraction of the dielectric thin-film layer.")
498+
]],
499+
uniform float iridescence_thickness_minimum = 100
500+
[[
501+
anno::soft_range(0.0, 600.0),
502+
anno::in_group("Iridescence"),
503+
anno::display_name("Iridescence Thickness Minimum"),
504+
anno::description("The minimum thickness of the thin-film layer given in nanometers.")
505+
]],
506+
uniform float iridescence_thickness_maximum = 400
507+
[[
508+
anno::soft_range(0.0, 1000.0),
509+
anno::in_group("Iridescence"),
510+
anno::display_name("Iridescence Thickness Maximum"),
511+
anno::description("The maximum thickness of the thin-film layer given in nanometers. Used as thickness if no 'Iridescence Thickness Texture' if available.")
512+
]],
513+
gltf_texture_lookup_value iridescence_thickness_texture = gltf_texture_lookup()
514+
[[
515+
anno::in_group("Iridescence"),
516+
anno::display_name("Iridescence Thickness Texture"),
517+
anno::description("The thickness texture of the thin-film layer. Uses only the red channel, assuming linear space. Used to blend between 'Iridescence Thickness Minimum' and 'Iridescence Thickness Maximum'."),
518+
anno::enable_if("iridescence_factor>0")
519+
]],
520+
477521
// emission
478522
uniform color emissive_factor = color(0.0)
479523
[[
@@ -568,7 +612,7 @@ export material gltf_material(
568612
// ------------------------------------------------------------------------
569613
float4 base_float4 = gltf_prepare_tex_float4(base_color_texture) * scene::data_lookup_float4("COLOR_0", float4(1.0)); // apply vertex color
570614
color base_color = base_color_factor * color(base_float4.x, base_float4.y, base_float4.z);
571-
float alpha = base_alpha * base_float4.w;
615+
float alpha = base_alpha * math::pow(base_float4.w, 1.0/2.2);
572616

573617
float3 metallic_roughness = gltf_prepare_tex_float3(metallic_roughness_texture);
574618
float metallic = metallic_factor * metallic_roughness.z;
@@ -600,6 +644,11 @@ export material gltf_material(
600644
float3 clearcoat_normal = gltf_prepare_normal(clearcoat_normal_texture);
601645
float grazing_refl_coat = math::max((1.0 - clearcoat_roughness), 0.0);
602646

647+
// KHR_materials_iridescence
648+
// ------------------------------------------------------------------------
649+
float iridescence_strength = gltf_prepare_tex_float3(iridescence_texture).x * iridescence_factor;
650+
float iridescence_thickness = math::lerp(iridescence_thickness_minimum, iridescence_thickness_maximum, gltf_prepare_tex_float3(iridescence_thickness_texture).x);
651+
603652
// metallic roughness model
604653
// ------------------------------------------------------------------------
605654

@@ -630,13 +679,41 @@ export material gltf_material(
630679
normal: normal
631680
);
632681

633-
// the metallic component doesn't have a diffuse component,
682+
// apply iridescence and make the strength adjustable using a weighted layer
683+
bsdf dielectric_component_with_thin_film = df::weighted_layer(
684+
weight: iridescence_strength,
685+
base: dielectric_component,
686+
layer: df::thin_film(
687+
thickness: iridescence_thickness,
688+
ior: color(iridescence_ior),
689+
base: dielectric_component
690+
)
691+
);
692+
693+
// the metallic component doesn't have a diffuse component,
634694
// its only glossy base_color is applied to tint it
635695
bsdf metallic_component = df::microfacet_ggx_vcavities_bsdf(
636-
tint: base_color * occlusion,
696+
tint: base_color * occlusion,
637697
roughness_u: roughness2);
638698

639-
// apply sheen to the dielectic component
699+
// apply iridescence and make the strength adjustable using a weighted layer
700+
// according to KHR_materials_iridescence spec: using dielectric thin film fresnel for metals, too
701+
color base_color_sqrt = math::min(math::sqrt(math::saturate(base_color * occlusion)), color(0.99f));
702+
color dielectric_ior = (color(1.0f) + base_color_sqrt) / (color(1.0f) - base_color_sqrt);
703+
bsdf metallic_component_with_thin_film = df::weighted_layer(
704+
weight: iridescence_strength,
705+
base: metallic_component,
706+
layer: df::thin_film(
707+
thickness: iridescence_thickness,
708+
ior: color(iridescence_ior),
709+
base: df::fresnel_factor(
710+
ior: dielectric_ior,
711+
extinction_coefficient: color(0.0f),
712+
base: df::microfacet_ggx_vcavities_bsdf(roughness_u: roughness2))
713+
)
714+
);
715+
716+
// apply sheen to the dielectric component
640717
// add the sheen_color as weight in an outer layer to be able to blend and disable on default
641718
// otherwise, sheen would be applied and tinted black
642719
bsdf dielectric_sheen_component = df::color_weighted_layer(
@@ -645,15 +722,15 @@ export material gltf_material(
645722
roughness: sheen_roughness * sheen_roughness,
646723
tint: color(1.0),
647724
multiscatter_tint: color(1.0),
648-
multiscatter: dielectric_component
725+
multiscatter: dielectric_component // don't apply thin_film
649726
),
650-
base: dielectric_component);
727+
base: dielectric_component_with_thin_film);
651728

652729
// final BSDF is a linear blend between dielectric and metallic component
653730
bsdf dielectric_metal_mix = df::weighted_layer(
654731
weight: metallic,
655732
base: dielectric_sheen_component,
656-
layer: metallic_component,
733+
layer: metallic_component_with_thin_film,
657734
normal: normal);
658735

659736
bsdf clearcoated = df::custom_curve_layer(
@@ -806,11 +883,11 @@ export material gltf_material_khr_specular_glossiness(
806883
// ------------------------------------------------------------------------
807884
float4 diffuse_float4 = gltf_prepare_tex_float4(diffuse_texture) * scene::data_lookup_float4("COLOR_0", float4(1.0)); // apply vertex color
808885
color diffuse = diffuse_factor * color(diffuse_float4.x, diffuse_float4.y, diffuse_float4.z);
809-
float alpha = base_alpha * diffuse_float4.w;
886+
float alpha = base_alpha * math::pow(diffuse_float4.w, 1.0/2.2);
810887

811888
float4 specular_glossiness = gltf_prepare_tex_float4(specular_glossiness_texture);
812889
color specular = specular_factor * color(specular_glossiness.x, specular_glossiness.y, specular_glossiness.z);
813-
float glossiness = glossiness_factor * specular_glossiness.w;
890+
float glossiness = glossiness_factor * math::pow(specular_glossiness.w, 1.0/2.2);
814891

815892
float3 normal = gltf_prepare_normal(normal_texture);
816893
float occlusion = gltf_prepare_occlusion(occlusion_texture, occlusion_strength);

examples/mdl_python/CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,20 @@ elseif ("MDL_SOURCE_RELEASE" IN_LIST MDL_ADDITIONAL_COMPILER_DEFINES)
5151
if(TARGET "mdl::dds")
5252
get_property(DDS_PATH TARGET "mdl::dds" PROPERTY BINARY_DIR)
5353
endif()
54+
if(TARGET "mdl::mdl_distiller")
55+
get_property(MDLDISTILLER_PATH TARGET "mdl::mdl_distiller" PROPERTY BINARY_DIR)
56+
endif()
5457
set(ENV_MDL_SDK_PATH ${MDL_SDK_PATH})
5558
set(ENV_FREEIMAGE_PATH ${FREEIMAGE_PATH})
5659
set(ENV_OPENIMAGEIO_PATH ${OPENIMAGEIO_PATH})
5760
set(ENV_DDS_PATH ${DDS_PATH})
61+
set(ENV_MDLDISTILLER_PATH ${MDLDISTILLER_PATH})
5862
if(WINDOWS)
5963
set(ENV_MDL_SDK_PATH_BAT ${MDL_SDK_PATH})
6064
set(ENV_FREEIMAGE_PATH_BAT ${FREEIMAGE_PATH})
6165
set(ENV_OPENIMAGEIO_PATH_BAT ${OPENIMAGEIO_PATH})
6266
set(ENV_DDS_PATH_BAT ${DDS_PATH})
67+
set(ENV_MDLDISTILLER_PATH_BAT ${MDLDISTILLER_PATH})
6368
# for running the shell scripts on windows (e.g. using git bash or mingw)
6469
# we need to adjust the strings that go into the PATH to use a unix-like format
6570
if(${MDL_SDK_PATH})
@@ -94,6 +99,14 @@ elseif ("MDL_SOURCE_RELEASE" IN_LIST MDL_ADDITIONAL_COMPILER_DEFINES)
9499
set(ENV_DDS_PATH "/${_CHAR_AT_0}${ENV_DDS_PATH}")
95100
endif()
96101
endif()
102+
if(${MDLDISTILLER_PATH})
103+
string(SUBSTRING ${MDLDISTILLER_PATH} 1 1 _CHAR_AT_1)
104+
if(_CHAR_AT_1 STREQUAL ":")
105+
string(SUBSTRING ${MDLDISTILLER_PATH} 0 1 _CHAR_AT_0)
106+
string(SUBSTRING ${MDLDISTILLER_PATH} 2 -1 ENV_MDLDISTILLER_PATH)
107+
set(ENV_MDLDISTILLER_PATH "/${_CHAR_AT_0}${ENV_MDLDISTILLER_PATH}")
108+
endif()
109+
endif()
97110
endif()
98111
set(_VS_CODE_FILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/mdl_python_examples.open_source.code-workspace)
99112
set(_SETUP_ENV_FILE_IN_SH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/setup_env.open_source.sh)

0 commit comments

Comments
 (0)