From 81e3e24f7f9940c0a2f31d6e519d55857a9fc909 Mon Sep 17 00:00:00 2001 From: Lee Kerley <154285602+ld-kerley@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:34:43 -0700 Subject: [PATCH 1/3] Align smoothstep edge cases with OSL (#1985) Following a conversation on ASWF slack this PR was posted to OSL refining the edge cases for `smoothstep()`. https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1851 This PR aligns the GLSL/MSL code with this change. --- libraries/stdlib/genglsl/mx_smoothstep_float.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/stdlib/genglsl/mx_smoothstep_float.glsl b/libraries/stdlib/genglsl/mx_smoothstep_float.glsl index 1bca2e4d9b..0b317bdf33 100644 --- a/libraries/stdlib/genglsl/mx_smoothstep_float.glsl +++ b/libraries/stdlib/genglsl/mx_smoothstep_float.glsl @@ -1,9 +1,9 @@ void mx_smoothstep_float(float val, float low, float high, out float result) { - if (val <= low) - result = 0.0; - else if (val >= high) + if (val >= high) result = 1.0; + else if (val <= low) + result = 0.0; else result = smoothstep(low, high, val); } From 093b8195db3386f5d2f19dfdfee6eb9165116b09 Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Fri, 6 Sep 2024 17:12:55 -0700 Subject: [PATCH 2/3] Initial implementation of Disney Principled (#2004) This changelist adds an initial MaterialX graph for the Disney Principled BSDF, as described in Brent Burley's 2012 and 2015 presentations. For simplicity, the original separated interfaces for `disney_brdf_2012` and `disney_bsdf_2015` have been merged into a single `disney_principled` interface, providing artists with a unified entry point for the shading model. Where possible, the original empirical approach of Disney Principled has been preserved, including the use of the `burley_diffuse_bsdf` and `generalized_schlick_bsdf` nodes, though a few simplifications have been employed, including the use of the `layer` node for physically based layering and the `sheen_bsdf` node for the sheen layer. --- documents/Specification/MaterialX.PBRSpec.md | 10 ++ .../Specification/MaterialX.Specification.md | 4 +- libraries/bxdf/disney_brdf_2015.mtlx | 25 ---- libraries/bxdf/disney_principled.mtlx | 140 ++++++++++++++++++ .../disney_principled_carpaint.mtlx | 12 ++ .../disney_principled_default.mtlx | 17 ++- .../disney_principled_glass.mtlx | 12 ++ .../disney_principled_gold.mtlx | 11 ++ .../disney_principled_plastic.mtlx | 10 ++ 9 files changed, 206 insertions(+), 35 deletions(-) delete mode 100644 libraries/bxdf/disney_brdf_2015.mtlx create mode 100644 libraries/bxdf/disney_principled.mtlx create mode 100644 resources/Materials/Examples/DisneyPrincipled/disney_principled_carpaint.mtlx rename libraries/bxdf/disney_brdf_2012.mtlx => resources/Materials/Examples/DisneyPrincipled/disney_principled_default.mtlx (60%) create mode 100644 resources/Materials/Examples/DisneyPrincipled/disney_principled_glass.mtlx create mode 100644 resources/Materials/Examples/DisneyPrincipled/disney_principled_gold.mtlx create mode 100644 resources/Materials/Examples/DisneyPrincipled/disney_principled_plastic.mtlx diff --git a/documents/Specification/MaterialX.PBRSpec.md b/documents/Specification/MaterialX.PBRSpec.md index 2e314d479d..298f0fb0b2 100644 --- a/documents/Specification/MaterialX.PBRSpec.md +++ b/documents/Specification/MaterialX.PBRSpec.md @@ -381,6 +381,14 @@ Note that the standard library includes definitions for [**`displacement`**](./M This section contains examples of shading model implementations using the MaterialX PBS library. For all examples, the shading model is defined via a <nodedef> interface plus a nodegraph implementation. The resulting nodes can be used as shaders by a MaterialX material definition. +## Disney Principled BSDF + +This shading model was presented by Brent Burley from Walt Disney Animation Studios in 2012[^Burley2012], with additional refinements presented in 2015[^Burley2015]. + +A MaterialX definition and nodegraph implementation of the Disney Principled BSDF can be found here: +[https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/disney_principled.mtlx](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/bxdf/disney_principled.mtlx) + + ## Autodesk Standard Surface This is a surface shading model used in Autodesk products created by the Solid Angle team for the Arnold renderer. It is an über shader built from ten different BSDF layers[^Georgiev2019]. @@ -430,6 +438,8 @@ The MaterialX PBS Library includes a number of nodegraphs that can be used to ap [^Burley2012]: Brent Burley, **Physically-Based Shading at Disney**, , 2012 +[^Burley2015]: Brent Burley, **Extending the Disney BRDF to a BSDF with Integrated Subsurface Scattering**, , 2015 + [^Christensen2015]: Per H. Christensen, Brent Burley, **Approximate Reflectance Profiles for Efficient Subsurface Scattering**, 2015 [^Conty2017]: Alejandro Conty, Christopher Kulla, **Production Friendly Microfacet Sheen BRDF**, , 2017 diff --git a/documents/Specification/MaterialX.Specification.md b/documents/Specification/MaterialX.Specification.md index 60e62d9ce2..29b480f7cb 100644 --- a/documents/Specification/MaterialX.Specification.md +++ b/documents/Specification/MaterialX.Specification.md @@ -2387,7 +2387,7 @@ Custom nodes that output data types with a "shader" semantic are referred to in The attributes for <nodedef> elements as they pertain to the declaration of shaders are: * `name` (string, required): a user-chosen name for this shader node definition element. -* `node` (string, required): the name of the shader node being defined, which typically matches the name of an associated shader function such as “blinn_phong”, “Disney_BRDF_2012”, “volumecloud_vol”. Just as for custom nodes, this shading program may be defined precisely through an <implementation> or <nodegraph>, or left to the application to locate by name using any shader definition method that it chooses. +* `node` (string, required): the name of the shader node being defined, which typically matches the name of an associated shader function such as “blinn_phong”, “disney_principled”, “volumecloud_vol”. Just as for custom nodes, this shading program may be defined precisely through an <implementation> or <nodegraph>, or left to the application to locate by name using any shader definition method that it chooses. The child <output> element within the <nodedef> defines the "data type" of the output for this shader, which must have been defined with a "shader" semantic; see the [Custom Data Types](#custom-data-types) section above and discussion below for details. @@ -2707,8 +2707,6 @@ Example uses for variants include defining a number of allowable colors and text Variants and variantsets are not intrinsically associated with any particular material; they merely state a number of values for a number of named inputs/tokens. However, variantsets may state that they are associated with specific shader-semantic nodes and/or <nodedef> declarations by providing stringarray-type `node` and/or `nodedef` attributes: ```xml - - ... ... ``` diff --git a/libraries/bxdf/disney_brdf_2015.mtlx b/libraries/bxdf/disney_brdf_2015.mtlx deleted file mode 100644 index 916c7d55af..0000000000 --- a/libraries/bxdf/disney_brdf_2015.mtlx +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libraries/bxdf/disney_principled.mtlx b/libraries/bxdf/disney_principled.mtlx new file mode 100644 index 0000000000..72394cb84f --- /dev/null +++ b/libraries/bxdf/disney_principled.mtlx @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Materials/Examples/DisneyPrincipled/disney_principled_carpaint.mtlx b/resources/Materials/Examples/DisneyPrincipled/disney_principled_carpaint.mtlx new file mode 100644 index 0000000000..7c5a0ae94f --- /dev/null +++ b/resources/Materials/Examples/DisneyPrincipled/disney_principled_carpaint.mtlx @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/libraries/bxdf/disney_brdf_2012.mtlx b/resources/Materials/Examples/DisneyPrincipled/disney_principled_default.mtlx similarity index 60% rename from libraries/bxdf/disney_brdf_2012.mtlx rename to resources/Materials/Examples/DisneyPrincipled/disney_principled_default.mtlx index d65e7dbc55..717d769870 100644 --- a/libraries/bxdf/disney_brdf_2012.mtlx +++ b/resources/Materials/Examples/DisneyPrincipled/disney_principled_default.mtlx @@ -1,18 +1,21 @@ - + - - - + - - - + + + + + + + + diff --git a/resources/Materials/Examples/DisneyPrincipled/disney_principled_glass.mtlx b/resources/Materials/Examples/DisneyPrincipled/disney_principled_glass.mtlx new file mode 100644 index 0000000000..dfb1fab67d --- /dev/null +++ b/resources/Materials/Examples/DisneyPrincipled/disney_principled_glass.mtlx @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/resources/Materials/Examples/DisneyPrincipled/disney_principled_gold.mtlx b/resources/Materials/Examples/DisneyPrincipled/disney_principled_gold.mtlx new file mode 100644 index 0000000000..f0dde69049 --- /dev/null +++ b/resources/Materials/Examples/DisneyPrincipled/disney_principled_gold.mtlx @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/resources/Materials/Examples/DisneyPrincipled/disney_principled_plastic.mtlx b/resources/Materials/Examples/DisneyPrincipled/disney_principled_plastic.mtlx new file mode 100644 index 0000000000..7b2561b5ec --- /dev/null +++ b/resources/Materials/Examples/DisneyPrincipled/disney_principled_plastic.mtlx @@ -0,0 +1,10 @@ + + + + + + + + + + From 8bc6fbc1b71688795775c32baedf296c883a2635 Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Sat, 7 Sep 2024 16:21:48 -0700 Subject: [PATCH 3/3] Updates to GitHub CI (#2008) - Update MacOS from Xcode 15.0 to 15.4. - Update MacOS from Python 3.7 to 3.9. - Update Linux from GCC 12 to 13. - Consolidate Linux builds for efficiency. --- .github/workflows/main.yml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 987aaa4839..c9750eb355 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,22 +23,15 @@ jobs: compiler: gcc compiler_version: "9" python: 3.7 - cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON + cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON -DMATERIALX_BUILD_MONOLITHIC=ON - - name: Linux_GCC_12_Python311 - os: ubuntu-22.04 + - name: Linux_GCC_13_Python311 + os: ubuntu-24.04 compiler: gcc - compiler_version: "12" + compiler_version: "13" python: 3.11 build_javascript: ON - - name: Linux_GCC_12_Python311_Static_Monolithic - os: ubuntu-22.04 - compiler: gcc - compiler_version: "12" - python: 3.11 - cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON -DMATERIALX_BUILD_MONOLITHIC=ON - - name: Linux_GCC_14_Python312 os: ubuntu-24.04 compiler: gcc @@ -48,7 +41,7 @@ jobs: cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Linux_GCC_CoverageAnalysis - os: ubuntu-22.04 + os: ubuntu-24.04 compiler: gcc compiler_version: "None" python: None @@ -70,12 +63,12 @@ jobs: test_render: ON clang_format: ON - - name: MacOS_Xcode_13_Python37 + - name: MacOS_Xcode_13_Python39 os: macos-12 compiler: xcode compiler_version: "13.1" cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON - python: 3.7 + python: 3.9 - name: MacOS_Xcode_14_Python311 os: macos-14 @@ -86,14 +79,14 @@ jobs: - name: MacOS_Xcode_15_Python312 os: macos-14 compiler: xcode - compiler_version: "15.0" + compiler_version: "15.4" python: 3.12 test_shaders: ON - name: MacOS_Xcode_DynamicAnalysis os: macos-14 compiler: xcode - compiler_version: "15.0" + compiler_version: "15.4" python: None dynamic_analysis: ON cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON @@ -101,7 +94,7 @@ jobs: - name: iOS_Xcode_15 os: macos-14 compiler: xcode - compiler_version: "15.0" + compiler_version: "15.4" python: None cmake_config: -DMATERIALX_BUILD_IOS=ON -DCMAKE_OSX_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` -DCMAKE_OSX_ARCHITECTURES=arm64