Skip to content

Commit 3f1c407

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into shadergen_validation
2 parents 4663914 + 92bfb86 commit 3f1c407

33 files changed

Lines changed: 570 additions & 536 deletions

.github/workflows/main.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
cmake_config: -G "Visual Studio 17 2022" -A "x64"
116116
test_shaders: ON
117117
extended_build_oiio: ON
118+
extended_build_mdl_sdk: ON
118119

119120
- name: Windows_VS2022_x64_SharedLibs
120121
os: windows-2025
@@ -167,6 +168,12 @@ jobs:
167168
C:/vcpkg/vcpkg install openimageio --triplet=x64-windows
168169
Add-Content $env:GITHUB_PATH "C:/vcpkg/installed/x64-windows/bin"
169170
171+
- name: Install MDL SDK
172+
if: env.IS_EXTENDED_BUILD == 'true' && matrix.extended_build_mdl_sdk == 'ON' && runner.os == 'Windows'
173+
run: |
174+
C:/vcpkg/vcpkg install mdl-sdk --triplet=x64-windows
175+
Add-Content $env:GITHUB_PATH "C:/vcpkg/installed/x64-windows/bin"
176+
170177
- name: Install Python ${{ matrix.python }}
171178
if: matrix.python != 'None'
172179
uses: actions/setup-python@v5
@@ -185,8 +192,16 @@ jobs:
185192
- name: CMake Generate
186193
shell: bash
187194
run: |
188-
if [ "${{ env.IS_EXTENDED_BUILD }}" == "true" ] && [ "${{ matrix.extended_build_oiio }}" == "ON" ]; then
189-
EXTENDED_BUILD_CONFIG="-DMATERIALX_BUILD_OIIO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows"
195+
if [ "${{ env.IS_EXTENDED_BUILD }}" == "true" ]; then
196+
if [ "${{ runner.os }}" == "Windows" ]; then
197+
EXTENDED_BUILD_CONFIG="-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows"
198+
fi
199+
if [ "${{ matrix.extended_build_oiio }}" == "ON" ]; then
200+
EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DMATERIALX_BUILD_OIIO=ON"
201+
fi
202+
if [ "${{ matrix.extended_build_mdl_sdk }}" == "ON" -a "${{ runner.os }}" == "Windows" ]; then
203+
EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DMATERIALX_MDL_SDK_DIR=C:/vcpkg/installed/x64-windows"
204+
fi
190205
fi
191206
cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_BUILD_TESTS=ON -DMATERIALX_TEST_RENDER=OFF -DMATERIALX_WARNINGS_AS_ERRORS=ON $EXTENDED_BUILD_CONFIG ${{matrix.cmake_config}}
192207

CMakeLists.txt

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
1414
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
1515
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
1616

17-
# JavaScript setup
17+
# JavaScript setup
1818
option(MATERIALX_BUILD_JS "Build the MaterialX JavaScript package from C++ bindings. Requires the emscripten environment." OFF)
1919
set(MATERIALX_EMSDK_PATH "" CACHE PATH "Path to EMSDK (e.g. 'D:/Projects/emsdk').")
2020
if (MATERIALX_BUILD_JS)
@@ -147,13 +147,8 @@ if (MATERIALX_BUILD_OSOS)
147147
endif()
148148

149149
# Helpers for MDL validation
150-
if (MATERIALX_BUILD_GEN_MDL)
151-
set(MATERIALX_MDLC_EXECUTABLE "" CACHE FILEPATH "Full path to the mdlc binary.")
152-
set(MATERIALX_MDL_RENDER_EXECUTABLE "" CACHE FILEPATH "Full path to the mdl renderer binary.")
153-
set(MATERIALX_MDL_RENDER_ARGUMENTS "" CACHE STRING "Custom arguments for renderer.")
154-
set(MATERIALX_MDL_MODULE_PATHS "" CACHE FILEPATH "Comma separated list of MDL module paths.")
155-
set(MATERIALX_INSTALL_MDL_MODULE_PATH ${MATERIALX_INSTALL_STDLIB_PATH} CACHE FILEPATH "Install path for mdl module.")
156-
endif()
150+
set(MATERIALX_MDL_SDK_DIR "" CACHE PATH "Path to the MDL SDK directory that contains 'include', 'lib', etc.")
151+
set(MATERIALX_MDL_MODULE_PATHS "" CACHE FILEPATH "Comma separated list of MDL module paths.")
157152

158153
# Namespace
159154
set(MATERIALX_NAMESPACE_SUFFIX "" CACHE STRING "Add a suffix to the main MaterialX C++ namespace: Options include dev, staging, <YOURFACILITY> etc.")
@@ -207,13 +202,9 @@ mark_as_advanced(MATERIALX_BUILD_JS)
207202
mark_as_advanced(MATERIALX_EMSDK_PATH)
208203
mark_as_advanced(MATERIALX_BUILD_IOS)
209204
mark_as_advanced(MATERIALX_BUILD_APPLE_FRAMEWORK)
210-
if (MATERIALX_BUILD_GEN_MDL)
211-
mark_as_advanced(MATERIALX_MDLC_EXECUTABLE)
212-
mark_as_advanced(MATERIALX_MDL_RENDER_EXECUTABLE)
213-
mark_as_advanced(MATERIALX_MDL_RENDER_ARGUMENTS)
214-
mark_as_advanced(MATERIALX_MDL_MODULE_PATHS)
215-
mark_as_advanced(MATERIALX_INSTALL_MDL_MODULE_PATH)
216-
endif()
205+
mark_as_advanced(MATERIALX_MDL_BINARY_MDLC)
206+
mark_as_advanced(MATERIALX_MDL_MODULE_PATHS)
207+
mark_as_advanced(MATERIALX_MDL_SDK_DIR)
217208

218209
if (MATERIALX_BUILD_USE_CCACHE)
219210
# Setup CCache for C/C++ compilation
@@ -251,12 +242,11 @@ if (MATERIALX_BUILD_BENCHMARK_TESTS)
251242
add_definitions(-DMATERIALX_BUILD_BENCHMARK_TESTS)
252243
endif()
253244

254-
if (MATERIALX_BUILD_GEN_MDL)
255-
add_definitions(-DMATERIALX_MDLC_EXECUTABLE=\"${MATERIALX_MDLC_EXECUTABLE}\")
256-
add_definitions(-DMATERIALX_MDL_RENDER_EXECUTABLE=\"${MATERIALX_MDL_RENDER_EXECUTABLE}\")
257-
add_definitions(-DMATERIALX_MDL_RENDER_ARGUMENTS=\"${MATERIALX_MDL_RENDER_ARGUMENTS}\")
258-
add_definitions(-DMATERIALX_MDL_MODULE_PATHS=\"${MATERIALX_MDL_MODULE_PATHS}\")
259-
add_definitions(-DMATERIALX_INSTALL_MDL_MODULE_PATH=\"${MATERIALX_INSTALL_MDL_MODULE_PATH}\")
245+
# GEN MDL does not have any additional dependencies. For loading and compiling MDL, e.g., in the test renderer, the MDL SDK is needed.
246+
if(MATERIALX_MDL_SDK_DIR)
247+
find_package(mdl QUIET CONFIG REQUIRED PATHS ${MATERIALX_MDL_SDK_DIR})
248+
get_target_property(MATERIALX_MDL_BINARY_MDLC mdl::mdlc LOCATION)
249+
set(MATERIALX_MDL_BINARY_MDLC ${MATERIALX_MDL_BINARY_MDLC} CACHE FILEPATH "Full path to the mdlc binary." FORCE)
260250
endif()
261251

262252
# Adjust the default installation path

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ MaterialX is an open standard for representing rich material and look-developmen
1717
- Point CMake to the root of the MaterialX library and generate C++ projects for your platform and compiler.
1818
- Select the `MATERIALX_BUILD_PYTHON` option to build Python bindings.
1919
- Select the `MATERIALX_BUILD_VIEWER` option to build the [MaterialX Viewer](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/DeveloperGuide/Viewer.md).
20-
- Select the `MATERIALX_BUILD_GRAPH_EDITOR` option to build the [MaterialX Graph Editor](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/DeveloperGuide/GraphEditor.md).
20+
- Select the `MATERIALX_BUILD_GRAPH_EDITOR` option to build the [MaterialX Graph Editor](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/DeveloperGuide/GraphEditor.md).
2121

2222
## Supported Platforms
2323

libraries/bxdf/genglsl/gltf_pbr.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
<input name="in" type="vector3" nodename="rotate_tangent" />
309309
</normalize>
310310
<absval name="abs_anisotropy_rotation" type="float">
311-
<input name="in" type="float" interfacename="anisotropy_rotation"/>
311+
<input name="in" type="float" interfacename="anisotropy_rotation" />
312312
</absval>
313313
<ifgreater name="selected_tangent" type="vector3">
314314
<input name="value1" type="float" nodename="abs_anisotropy_rotation" />

libraries/bxdf/genglsl/open_pbr_surface.mtlx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,21 @@
211211
</multiply>
212212

213213
<!-- Dielectric Base -->
214-
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
215-
<divide name="specular_to_coat_ior_ratio" type="float">
216-
<input name="in1" type="float" interfacename="specular_ior" />
217-
<input name="in2" type="float" interfacename="coat_ior" />
218-
</divide>
219-
<divide name="coat_to_specular_ior_ratio" type="float">
220-
<input name="in1" type="float" interfacename="coat_ior" />
221-
<input name="in2" type="float" interfacename="specular_ior" />
222-
</divide>
223-
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
224-
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
225-
<input name="value2" type="float" value="1.0" />
226-
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
227-
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
228-
</ifgreater>
214+
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
215+
<divide name="specular_to_coat_ior_ratio" type="float">
216+
<input name="in1" type="float" interfacename="specular_ior" />
217+
<input name="in2" type="float" interfacename="coat_ior" />
218+
</divide>
219+
<divide name="coat_to_specular_ior_ratio" type="float">
220+
<input name="in1" type="float" interfacename="coat_ior" />
221+
<input name="in2" type="float" interfacename="specular_ior" />
222+
</divide>
223+
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
224+
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
225+
<input name="value2" type="float" value="1.0" />
226+
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
227+
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
228+
</ifgreater>
229229
<mix name="eta_s" type="float">
230230
<input name="fg" type="float" nodename="specular_to_coat_ior_ratio_tir_fix" />
231231
<input name="bg" type="float" interfacename="specular_ior" />
@@ -546,8 +546,7 @@
546546
<!--
547547
OpenPBR Anisotropy node definition
548548
-->
549-
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr"
550-
doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
549+
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr" doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
551550
<input name="roughness" type="float" value="0.0" />
552551
<input name="anisotropy" type="float" value="0.0" />
553552
<output name="out" type="vector2" />

libraries/bxdf/genmdl/open_pbr_surface.mtlx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,21 @@
210210
</multiply>
211211

212212
<!-- Dielectric Base -->
213-
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
214-
<divide name="specular_to_coat_ior_ratio" type="float">
215-
<input name="in1" type="float" interfacename="specular_ior" />
216-
<input name="in2" type="float" interfacename="coat_ior" />
217-
</divide>
218-
<divide name="coat_to_specular_ior_ratio" type="float">
219-
<input name="in1" type="float" interfacename="coat_ior" />
220-
<input name="in2" type="float" interfacename="specular_ior" />
221-
</divide>
222-
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
223-
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
224-
<input name="value2" type="float" value="1.0" />
225-
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
226-
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
227-
</ifgreater>
213+
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
214+
<divide name="specular_to_coat_ior_ratio" type="float">
215+
<input name="in1" type="float" interfacename="specular_ior" />
216+
<input name="in2" type="float" interfacename="coat_ior" />
217+
</divide>
218+
<divide name="coat_to_specular_ior_ratio" type="float">
219+
<input name="in1" type="float" interfacename="coat_ior" />
220+
<input name="in2" type="float" interfacename="specular_ior" />
221+
</divide>
222+
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
223+
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
224+
<input name="value2" type="float" value="1.0" />
225+
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
226+
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
227+
</ifgreater>
228228
<mix name="eta_s" type="float">
229229
<input name="fg" type="float" nodename="specular_to_coat_ior_ratio_tir_fix" />
230230
<input name="bg" type="float" interfacename="specular_ior" />
@@ -326,7 +326,7 @@
326326
<layer name="dielectric_base_tf" type="BSDF">
327327
<input name="top" type="BSDF" nodename="dielectric_reflection_tf" />
328328
<input name="base" type="BSDF" nodename="dielectric_substrate" />
329-
</layer >
329+
</layer>
330330
<layer name="dielectric_base_notf" type="BSDF">
331331
<input name="top" type="BSDF" nodename="dielectric_reflection" />
332332
<input name="base" type="BSDF" nodename="dielectric_substrate" />
@@ -543,8 +543,7 @@
543543
<!--
544544
OpenPBR Anisotropy node definition
545545
-->
546-
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr"
547-
doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
546+
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr" doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
548547
<input name="roughness" type="float" value="0.0" />
549548
<input name="anisotropy" type="float" value="0.0" />
550549
<output name="out" type="vector2" />

libraries/bxdf/gltf_pbr.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
<input name="in" type="vector3" nodename="rotate_tangent" />
354354
</normalize>
355355
<absval name="abs_anisotropy_rotation" type="float">
356-
<input name="in" type="float" interfacename="anisotropy_rotation"/>
356+
<input name="in" type="float" interfacename="anisotropy_rotation" />
357357
</absval>
358358
<ifgreater name="selected_tangent" type="vector3">
359359
<input name="value1" type="float" nodename="abs_anisotropy_rotation" />

libraries/bxdf/lama/lama_iridescence.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<rotate3d name="tangent_rotate" type="vector3">
7373
<input name="in" type="vector3" interfacename="anisotropyDirection" />
7474
<input name="amount" type="float" nodename="tangent_rotate_degree_offset" />
75-
<input name="axis" type="vector3" nodename="tangent_normal" /> />
75+
<input name="axis" type="vector3" nodename="tangent_normal" />
7676
</rotate3d>
7777
<normalize name="tangent_rotate_normalize" type="vector3">
7878
<input name="in" type="vector3" nodename="tangent_rotate" />

libraries/bxdf/open_pbr_surface.mtlx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,21 +301,21 @@
301301
</multiply>
302302

303303
<!-- Dielectric Base -->
304-
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
305-
<divide name="specular_to_coat_ior_ratio" type="float">
306-
<input name="in1" type="float" interfacename="specular_ior" />
307-
<input name="in2" type="float" interfacename="coat_ior" />
308-
</divide>
309-
<divide name="coat_to_specular_ior_ratio" type="float">
310-
<input name="in1" type="float" interfacename="coat_ior" />
311-
<input name="in2" type="float" interfacename="specular_ior" />
312-
</divide>
313-
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
314-
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
315-
<input name="value2" type="float" value="1.0" />
316-
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
317-
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
318-
</ifgreater>
304+
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
305+
<divide name="specular_to_coat_ior_ratio" type="float">
306+
<input name="in1" type="float" interfacename="specular_ior" />
307+
<input name="in2" type="float" interfacename="coat_ior" />
308+
</divide>
309+
<divide name="coat_to_specular_ior_ratio" type="float">
310+
<input name="in1" type="float" interfacename="coat_ior" />
311+
<input name="in2" type="float" interfacename="specular_ior" />
312+
</divide>
313+
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
314+
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
315+
<input name="value2" type="float" value="1.0" />
316+
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
317+
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
318+
</ifgreater>
319319
<mix name="eta_s" type="float">
320320
<input name="fg" type="float" nodename="specular_to_coat_ior_ratio_tir_fix" />
321321
<input name="bg" type="float" interfacename="specular_ior" />

libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<output name="diffuse_roughness_out" type="float" />
5454
<output name="metalness_out" type="float" />
5555

56-
<output name="specular_out" type="float"/>
56+
<output name="specular_out" type="float" />
5757
<output name="specular_color_out" type="color3" />
5858
<output name="specular_roughness_out" type="float" />
5959
<output name="specular_IOR_out" type="float" />

0 commit comments

Comments
 (0)