Skip to content

Commit f917409

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into projection_definitions
2 parents 433ad0d + 68a94a2 commit f917409

79 files changed

Lines changed: 3239 additions & 789 deletions

File tree

Some content is hidden

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

.github/workflows/main.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
compiler: gcc
3232
compiler_version: "14"
3333
python: 3.13
34+
extended_build_perfetto: ON
3435

3536
- name: Linux_GCC_14_Python314
3637
os: ubuntu-24.04
@@ -206,6 +207,9 @@ jobs:
206207
if [ "${{ matrix.extended_build_mdl_sdk }}" == "ON" -a "${{ runner.os }}" == "Windows" ]; then
207208
EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DVCPKG_TARGET_TRIPLET=x64-windows-release -DMATERIALX_MDL_SDK_DIR=C:/vcpkg/installed/x64-windows-release"
208209
fi
210+
if [ "${{ matrix.extended_build_perfetto }}" == "ON" ]; then
211+
EXTENDED_BUILD_CONFIG="$EXTENDED_BUILD_CONFIG -DMATERIALX_BUILD_PERFETTO_TRACING=ON"
212+
fi
209213
fi
210214
TEST_RENDER_CONFIG="-DMATERIALX_TEST_RENDER=OFF"
211215
if [ "${{ matrix.test_render }}" == "ON" ]; then
@@ -266,7 +270,7 @@ jobs:
266270
run: |
267271
sudo apt-get install gcovr
268272
mkdir coverage
269-
gcovr --html --html-details --output coverage/index.html --exclude .*\/External\/.* --root .. .
273+
gcovr --html --html-details --output coverage/index.html --exclude .*\/External\/.* --exclude .*perfetto.* --root .. .
270274
working-directory: build
271275

272276
- name: Static Analysis Tests
@@ -277,7 +281,7 @@ jobs:
277281
else
278282
brew install cppcheck
279283
fi
280-
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/*
284+
cppcheck --project=build/compile_commands.json --error-exitcode=1 --suppress=normalCheckLevelMaxBranches --suppress=*:*/External/* --suppress=*:*/NanoGUI/* --suppress=*:*perfetto*
281285
282286
- name: Setup Rendering Environment (Linux)
283287
if: matrix.test_render == 'ON' && runner.os == 'Linux'
@@ -358,6 +362,14 @@ jobs:
358362
name: MaterialX_Coverage
359363
path: build/coverage
360364

365+
- name: Upload Perfetto Traces
366+
uses: actions/upload-artifact@v4
367+
if: matrix.extended_build_perfetto == 'ON' && env.IS_EXTENDED_BUILD == 'true'
368+
with:
369+
name: Traces_${{ matrix.name }}
370+
path: build/**/*.perfetto-trace
371+
if-no-files-found: ignore
372+
361373
javascript:
362374
name: JavaScript
363375
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,56 @@
22

33
## [1.39.5] - Development
44

5+
### Added
6+
- Added support for the [Slang shading language](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2548) in MaterialX shader generation and rendering, with [language bindings](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2679) for Python and JavaScript.
7+
- Added [OSL implementations](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2734) for hex-tiled images, completing cross-language coverage for hextiling nodes.
8+
- Added an [OSL command string code generator](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2603), enabling the mixing of external OSL shaders with MaterialX-generated nodes.
9+
- Added support for [GLSL probability density functions](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2779), providing a foundation for path-tracer use of generated GLSL, ESSL, and MSL shaders.
10+
- Added an [enableDirectLight option](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2773) to the MaterialX Viewer, enabling pure image-based lighting without direct light contributions.
11+
- Added support for [upstream and downstream node traversal](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2225) in the property editor of the MaterialX Graph Editor.
12+
- Added shader generation options for [Airy Fresnel iterations](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2569) and [constant node eliding](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2521), supporting quality and performance trade-offs on iridescent materials and interactive editing workflows.
13+
- Added [Python operator bindings](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2594) for Vector and Matrix types.
14+
- Added support for [Doxygen-generated docstrings](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2657) in MaterialX Python bindings, enabling IDE support and interactive help.
15+
- Added a [nodedef comparison script](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2723) for validating alignment between data library definitions and specification documents.
16+
- Added [Perfetto tracing](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2742) as an optional performance instrumentation framework.
17+
- Added a [nightly build workflow](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2621) to GitHub Actions, with [test suite rendering on MacOS](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2675) and [MDL compiler validation](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2254).
18+
- Added [developer guidelines](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2632) to the MaterialX contributing guide.
19+
20+
### Changed
21+
- Improved specifications for the [Standard Nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2520), [PBR Nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2732), and [NPR Nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2767), converting prose descriptions to structured tables.
22+
- Consolidated hardware shader generation in a new [MaterialXGenHw module](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2565), [unifying node implementations](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2555) across GLSL and MSL, adopting [syntax-portable type names](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2625) for native Metal support, and [streamlining](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2652) the ShaderGenerator API across hardware shading language generators.
23+
- Refactored the [layout engine](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2775) in the MaterialX Graph Editor, organizing its logic into a new Layout class aligned with the Sugiyama layered graph drawing algorithm.
24+
- Improved the [Metal syntax](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2622) in generated MSL shaders, replacing preprocessor workarounds with native Metal code.
25+
- Improved the [MDL generator](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2684) with support for backsurface shaders and [volume IOR](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2747) preservation.
26+
- Improved [thread safety](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2736) in the Document cache, adopting `std::shared_mutex` for reader and writer guarantees.
27+
- Improved [hextiling implementations](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2615) in GLSL and MDL, using array-based data structures for better maintainability.
28+
- Improved the translation graph from Standard Surface to glTF PBR, adding support for [specular and specular color](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2623), [IOR](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2589), [emissive strength](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2593), [dispersion](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2636), [normal and tangent](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2587), and [alpha](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2591).
29+
- Updated the [OpenPBR Surface definition](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2759) to connect geometry_thin_walled to the surface node.
30+
- Extended [shader generation tests](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2761) to cover all example materials.
31+
- Raised the default PyBind11 version to [PyBind11 3.0.1](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2715), with [Python 3.14](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2717) added to GitHub CI.
32+
- Raised the default Emscripten SDK to [emsdk 4.0.8](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2599) in the MaterialX Web Viewer.
33+
34+
### Fixed
35+
- Fixed [node key collisions](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2768) in ShaderGraph, addressing crashes and shader generation errors when multiple nodes shared the same base name.
36+
- Fixed the implementations of [splittb, ramptb, and ramp4](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2721) in GLSL, OSL, and MDL, correcting the inverted ordering of top and bottom values.
37+
- Fixed [sheen roughness](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2643) and the handling of [thin_walled and transmission_depth](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2644) in the translation graph from Standard Surface to glTF PBR.
38+
- Fixed [direct lighting](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2781) in MSL rendering, addressing a uniform name mismatch that caused missing lighting on MacOS.
39+
- Fixed a crash in shader generation for [constant nodes with zero inputs](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2746), with a [stricter eliding check](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2754) to prevent false matches on custom nodes.
40+
- Fixed a crash on selecting [functional graph outputs](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2597) in the MaterialX Graph Editor.
41+
- Fixed [CMake build rules](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2687) for resource installation, the [export](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2724) of MATERIALX_INSTALL_STDLIB_PATH in the CMake config, and the [propagation of dependencies](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2752) for OpenGL and X11 in downstream projects.
42+
- Fixed a [missing OCIO include](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2780) in the MaterialX Graph Editor, addressing a build error when OCIO support is enabled.
43+
- Fixed [shadow and environment edge cases](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2617) in GLSL generation, addressing spot light projection, shadow occlusion resetting, and zero-sample environment radiance.
44+
- Fixed alignment of [two-sided refraction](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2703) and [texture magnification filtering](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2705) between GLSL and MSL rendering.
45+
- Fixed OSL shader generation for [textureresource and LamaSurface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2590) nodes.
46+
- Fixed default inputs in the vector definitions of the [atan2 nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2554).
47+
- Fixed edge cases in the version upgrade process for [swizzle nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2637).
48+
- Fixed [Python interfaces](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2541) for image loaders.
49+
50+
### Removed
51+
- Removed the [NodeGraph dependency](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2601) in shader translation, using NodeDef outputs directly for improved flexibility.
52+
- Removed [global constructors](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2639) for Traversal constants, improving compatibility with MacOS environments.
53+
- Removed [unused static members](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2709) from the ShaderNode class.
54+
555
## [1.39.4] - 2025-09-15
656

757
### Added

CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ option(MATERIALX_BUILD_OCIO "Build OpenColorIO support for shader generators." O
5151
option(MATERIALX_BUILD_TESTS "Build unit tests." OFF)
5252
option(MATERIALX_BUILD_BENCHMARK_TESTS "Build benchmark tests." OFF)
5353
option(MATERIALX_BUILD_OSOS "Build OSL .oso's of standard library shaders for the OSL Network generator" OFF)
54+
option(MATERIALX_BUILD_PERFETTO_TRACING "Build with Perfetto tracing support for performance analysis." OFF)
5455

5556
option(MATERIALX_BUILD_SHARED_LIBS "Build MaterialX libraries as shared rather than static." OFF)
5657
option(MATERIALX_BUILD_DATA_LIBRARY "Build generated products from the MaterialX data library." OFF)
@@ -228,6 +229,41 @@ mark_as_advanced(MATERIALX_MDL_BINARY_TESTRENDER)
228229
mark_as_advanced(MATERIALX_MDL_MODULE_PATHS)
229230
mark_as_advanced(MATERIALX_MDL_SDK_DIR)
230231
mark_as_advanced(MATERIALX_SLANG_RHI_SOURCE_DIR)
232+
mark_as_advanced(MATERIALX_BUILD_PERFETTO_TRACING)
233+
234+
# Perfetto tracing support
235+
if(MATERIALX_BUILD_PERFETTO_TRACING)
236+
include(FetchContent)
237+
FetchContent_Declare(
238+
perfetto
239+
GIT_REPOSITORY https://android.googlesource.com/platform/external/perfetto
240+
GIT_TAG v43.0
241+
GIT_SHALLOW TRUE
242+
)
243+
# Only fetch the SDK, not the full Perfetto source
244+
set(PERFETTO_SDK_INCLUDE_DIR "${CMAKE_BINARY_DIR}/_deps/perfetto-src/sdk")
245+
FetchContent_MakeAvailable(perfetto)
246+
add_definitions(-DMATERIALX_BUILD_PERFETTO_TRACING)
247+
248+
# Define compile flags for perfetto.cc (Perfetto SDK triggers various warnings)
249+
# These variables are used in source/CMakeLists.txt (monolithic) and MaterialXTrace (non-monolithic)
250+
# Note: set_source_files_properties is directory-scoped, so we define variables here
251+
# but apply them in the directories where targets are created.
252+
if(MSVC)
253+
set(MATERIALX_PERFETTO_COMPILE_DEFINITIONS "NOMINMAX;WIN32_LEAN_AND_MEAN" CACHE INTERNAL "")
254+
# /bigobj: perfetto.cc has too many sections for default MSVC object format
255+
# /W0: disable all warnings for third-party Perfetto SDK code
256+
# /WX-: disable warnings-as-errors (overrides project-level /WX)
257+
set(MATERIALX_PERFETTO_COMPILE_FLAGS "/bigobj /W0 /WX-" CACHE INTERNAL "")
258+
else()
259+
set(MATERIALX_PERFETTO_COMPILE_DEFINITIONS "" CACHE INTERNAL "")
260+
# -Wno-error: Don't treat warnings as errors (Perfetto has shadowing issues)
261+
# -Wno-shadow: Suppress shadow warnings (kDevNull shadows global)
262+
set(MATERIALX_PERFETTO_COMPILE_FLAGS "-Wno-error -Wno-shadow" CACHE INTERNAL "")
263+
endif()
264+
265+
message(STATUS "Perfetto tracing support enabled")
266+
endif()
231267

232268
if (MATERIALX_BUILD_USE_CCACHE)
233269
# Setup CCache for C/C++ compilation
@@ -491,6 +527,9 @@ endif()
491527
# Add core subdirectories
492528
add_subdirectory(source/MaterialXCore)
493529
add_subdirectory(source/MaterialXFormat)
530+
if(MATERIALX_BUILD_PERFETTO_TRACING)
531+
add_subdirectory(source/MaterialXTrace)
532+
endif()
494533

495534
# Add shader generation subdirectories
496535
add_subdirectory(source/MaterialXGenShader)

GOVERNANCE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ The current Voting Members of the MaterialX TSC are:
4848
- Doug Smythe - Industrial Light & Magic
4949
- Niklas Harrysson - Lumiere Software
5050
- Orn Gunnarsson - Autodesk
51+
- Lee Kerley - Apple
52+
- Frankie Liu - NVIDIA
5153
- Andréa Machizaud - Adobe
5254

5355
### Stakeholders
@@ -66,8 +68,6 @@ The current Stakeholders of the MaterialX TSC are:
6668
- Fran González García - Pixar RenderMan
6769
- Ole Gulbrandsen - Sony Pictures Imageworks
6870
- Rafal Jaroszkiewicz - SideFX
69-
- Lee Kerley - Apple
70-
- Lutz Kettner - NVIDIA
7171
- Chris Kulla - Epic Games
7272
- Bernard Kwok - Khronos Group
7373
- Karen Lucknavalai - Pixar USD

documents/Specification/MaterialX.NPRSpec.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,35 +36,55 @@ This document describes a number of MaterialX nodes primarily applicable to non-
3636

3737
<a id="node-viewdirection"> </a>
3838

39-
* **`viewdirection`**: the current scene view direction (e.g. from the viewing/camera position to the current shading position). If `viewdirection` is used in a PBR shading context, it should be noted that this would be the same as the incident ray direction for primary ("camera") rays but **not** for secondary/reflection rays. This node must be of type vector3.
39+
### `viewdirection`
40+
The current scene view direction, as defined by the shading environment.
4041

41-
* `space` (uniform string): the space in which to return the view vector direction, defaults to `world`.
42+
The view direction is a normalized vector from the viewer position to the current shading position. In a PBR shading context, it represents the incident direction for primary camera rays, independent of any secondary or reflection rays.
43+
44+
|Port |Description |Type |Default|Accepted Values |
45+
|-------|--------------------------------------|-------|-------|--------------------|
46+
|`space`|The space of the view direction vector|string |world |model, object, world|
47+
|`out` |Output: view direction |vector3| | |
4248

4349

4450

4551
## NPR Utility Nodes
4652

4753
<a id="node-facingratio"> </a>
4854

49-
* **`facingratio`**: returns the geometric facing ratio, computed as the dot product between the view direction and geometric normal. Output is a float between 0.0 and 1.0.
55+
### `facingratio`
56+
The geometric facing ratio of the view direction and surface normal.
57+
58+
Facing ratio is computed as the dot product between the view direction and surface normal.
59+
60+
|Port |Description |Type |Default |
61+
|---------------|--------------------------------------------------------------------------|-------|--------|
62+
|`viewdirection`|The input view direction vector |vector3|_Vworld_|
63+
|`normal` |The input surface normal vector |vector3|_Nworld_|
64+
|`faceforward` |Makes the output always positive, facing towards the view direction |boolean|true |
65+
|`invert` |Inverts the output values by multiplying them by -1 |boolean|false |
66+
|`out` |Output: the float representing the ratio between view direction and normal|float | |
5067

51-
* `viewdirection` (vector3): the viewing direction, defaults to the value of the "Vworld" (world space view direction) geometric property.
52-
* `normal` (vector3): the surface normal vector, defaults to the value of the "Nworld" (world space view direction) geometric property. This vector is expected to be prenormalized to length 1.0.
53-
* `faceforward` (boolean): description needed; default is false.
54-
* `invert` (boolean): description needed; default is false.
5568

5669

5770

5871
## NPR Shading Nodes
5972

6073
<a id="node-gooch-shade"> </a>
6174

62-
* **`gooch_shade`**: Computes the single-pass shading portion of the Gooch[^Gooch1998] lighting model. Output type `surfaceshader`.
63-
* `warm_color` (color3): the "warm" color for shading, defaults to (0.8, 0.8, 0.7) in the `lin_rec709` colorspace.
64-
* `cool_color` (color3): the "cool" color for shading, defaults to (0.3, 0.3, 0.8) in the `lin_rec709` colorspace.
65-
* `specular_intensity` (float): the intensity of the specular component. Defaults to 1.0.
66-
* `shininess` (float): the specular power typically ranging from 1 to 256, defaults to 64.
67-
* `light_direction` (vector3): the incoming predominant lighting direction in world space, defaults to (1.0, -0.5, -0.5).
75+
### `gooch_shade`
76+
Computes the color from single-pass shading portion of the Gooch[^Gooch1998] lighting model.
77+
78+
Gooch shade provides an illustrative shading effect by blending colors based on the angle between the surface normal and the light direction. It also provides a simple Phong specular highlight, on top of the warm and cool colors.
79+
80+
|Port |Description |Type |Default |
81+
|--------------------|---------------------------------------|-------|-------------|
82+
|`warm_color` |The color facing toward the light |color3 |0.8, 0.8, 0.7|
83+
|`cool_color` |The color facing away from the light |color3 |0.3, 0.3, 0.8|
84+
|`specular_intensity`|The intensity of the highlight |float |1 |
85+
|`shininess` |The size of the highlight |float |64 |
86+
|`light_direction` |The world-space direction of the light |vector3|1, -0.5, -0.5|
87+
|`out` |Output: the Gooch lighting model result|color3 | |
6888

6989
<br>
7090

0 commit comments

Comments
 (0)