From 3ec6e873d1ba0a65d07ae065f235685225242752 Mon Sep 17 00:00:00 2001 From: Krzysztof Jakubowski Date: Fri, 9 Aug 2024 01:55:59 +0200 Subject: [PATCH 01/22] Fix swizzle edge cases in version upgrade (#1957) This PR fixes 2 edge cases when upgrading materials from version 1.38 to 1.39 involving swizzle nodes: - swizzle xyz -> xyz, rgb -> rgb wasn't handled properly, because convert nodedefs were missing for such cases - swizzle xy -> xxx is incorrectly changed to convert node --- source/MaterialXCore/Version.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/source/MaterialXCore/Version.cpp b/source/MaterialXCore/Version.cpp index 668c233bb7..34d9b3b02c 100644 --- a/source/MaterialXCore/Version.cpp +++ b/source/MaterialXCore/Version.cpp @@ -992,16 +992,19 @@ void Document::upgradeVersion() { "color3", 3 }, { "color4", 4 }, { "vector2", 2 }, { "vector3", 3 }, { "vector4", 4 } }; - const StringSet CHANNEL_CONVERT_PATTERNS = - { - "rgb", "rgba", "xyz", "xyzw", "rrr", "xxx" - }; - const vector> CHANNEL_ATTRIBUTE_PATTERNS = - { + const std::array, 10> CHANNEL_CONVERT_PATTERNS = + { { + { "rgb", 3 }, { "rgb", 4 }, { "rgba", 4 }, + { "xyz", 3 }, { "xyz", 4 }, { "xyzw", 4 }, + { "rr", 1 }, { "rrr", 1 }, + { "xx", 1 }, { "xxx", 1 } + } }; + const std::array, 3> CHANNEL_ATTRIBUTE_PATTERNS = + { { { { "xx", "xxx", "xxxx" }, "float" }, { { "xyz", "x", "y", "z" }, "vector3" }, { { "rgba", "a" }, "color4" } - }; + } }; // Convert channels attributes to legacy swizzle nodes, which are then converted // to modern nodes in a second pass. @@ -1169,8 +1172,10 @@ void Document::upgradeVersion() CHANNEL_COUNT_MAP.count(node->getType())) { string channelString = channelsInput ? channelsInput->getValueString() : EMPTY_STRING; - size_t sourceChannelCount = CHANNEL_COUNT_MAP.at(inInput->getType()); - size_t destChannelCount = CHANNEL_COUNT_MAP.at(node->getType()); + string sourceType = inInput->getType(); + string destType = node->getType(); + size_t sourceChannelCount = CHANNEL_COUNT_MAP.at(sourceType); + size_t destChannelCount = CHANNEL_COUNT_MAP.at(destType); // Resolve the invalid case of having both a connection and a value // by removing the value attribute. @@ -1228,7 +1233,8 @@ void Document::upgradeVersion() node->setInputValue("index", (int) CHANNEL_INDEX_MAP.at(channelString[0])); } } - else if (CHANNEL_CONVERT_PATTERNS.count(channelString)) + else if (sourceType != destType && std::find(CHANNEL_CONVERT_PATTERNS.begin(), CHANNEL_CONVERT_PATTERNS.end(), + std::make_pair(channelString, sourceChannelCount)) != CHANNEL_CONVERT_PATTERNS.end()) { // Replace swizzle with convert. node->setCategory("convert"); From 2884d74bb5d1707b19740b1c6d14f6b175a43042 Mon Sep 17 00:00:00 2001 From: Malia Kuo Date: Fri, 9 Aug 2024 13:51:26 -0700 Subject: [PATCH 02/22] Update documentation of OpenPBR and Standard Surface translations (#1963) Clarified documentation where the motivation for the conversion might not be clear - both for the translation graph from OpenPBR to Standard Surface, and the translation graph from Standard Surface to OpenPBR. --- libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx | 4 +++- libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx b/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx index 57b3f99d23..ec7bb19a98 100644 --- a/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx +++ b/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx @@ -198,6 +198,7 @@ + @@ -206,7 +207,7 @@ - + @@ -256,6 +257,7 @@ + diff --git a/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx b/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx index b454af4384..535f65b700 100644 --- a/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx +++ b/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx @@ -116,6 +116,7 @@ + @@ -129,7 +130,7 @@ - + @@ -190,12 +191,14 @@ + + From 588337873278d142cdbc12aa8df967d66dde465d Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Fri, 9 Aug 2024 15:29:37 -0700 Subject: [PATCH 03/22] Update changelog for recent work (#1964) --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40a8f23983..025a3b3627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,26 @@ ## [1.39.1] - Development +### Added +- Added initial shader translation graphs between [Standard Surface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1934) and [OpenPBR Surface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1949). +- Added initial support for [code generation hints](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1954). + +### Changed +- Raised the minimum CMake version to [CMake 3.24](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1929). +- Moved feature proposals from the main specification to a new [MaterialX Proposals](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1953) document. +- Updated the open definitions of the [MaterialX Lama nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1955) to improve alignment with RenderMan. + +### Fixed +- Fixed errors in the [installation steps](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1923) for CMake builds. +- Fixed the computation of [Fresnel transmission](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1962) in GLSL. +- Fixed transposed matrices in color transforms for the [displayp3 space](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1960). +- Fixed edge cases in the version upgrade process for [swizzle](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1945) [nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1957). +- Fixed a crash in the Graph Editor when [renaming a node graph](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1930). +- Fixed the exporting of [PugiXML symbols](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1944) in MaterialXFormat. + +### Removed +- Removed an extra installation of the [resources folder](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1927) in MaterialXGenShader. + ## [1.39.0] - 2024-07-05 ### Added From fb225ae6cefe4c1662b21767ae14634a3fe7a691 Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Sat, 10 Aug 2024 15:28:54 -0700 Subject: [PATCH 04/22] Update specification example (#1965) This changelist updates a specification example for clarity, reflecting the recent move of the `updirection` node to the MaterialX Proposals document. --- documents/Specification/MaterialX.Specification.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/Specification/MaterialX.Specification.md b/documents/Specification/MaterialX.Specification.md index 0232074701..60e62d9ce2 100644 --- a/documents/Specification/MaterialX.Specification.md +++ b/documents/Specification/MaterialX.Specification.md @@ -1124,7 +1124,7 @@ Application nodes are used to reference application-defined properties within a ```xml - +