diff --git a/libraries/bxdf/lama/lama_sss.mtlx b/libraries/bxdf/lama/lama_sss.mtlx index 1646a09570..ded26871ff 100644 --- a/libraries/bxdf/lama/lama_sss.mtlx +++ b/libraries/bxdf/lama/lama_sss.mtlx @@ -45,15 +45,12 @@ - - - - - + + - - + + @@ -61,7 +58,7 @@ - + diff --git a/libraries/bxdf/open_pbr_surface.mtlx b/libraries/bxdf/open_pbr_surface.mtlx index 665e369f4b..edd44a5858 100644 --- a/libraries/bxdf/open_pbr_surface.mtlx +++ b/libraries/bxdf/open_pbr_surface.mtlx @@ -177,16 +177,13 @@ - - - - - + + - + diff --git a/libraries/bxdf/standard_surface.mtlx b/libraries/bxdf/standard_surface.mtlx index fe87f260b0..20ef806699 100644 --- a/libraries/bxdf/standard_surface.mtlx +++ b/libraries/bxdf/standard_surface.mtlx @@ -230,17 +230,14 @@ - - - - - + + - + diff --git a/libraries/pbrlib/genosl/legacy/mx_subsurface_bsdf.osl b/libraries/pbrlib/genosl/legacy/mx_subsurface_bsdf.osl index 17a4aff2cb..da0e3cc12a 100644 --- a/libraries/pbrlib/genosl/legacy/mx_subsurface_bsdf.osl +++ b/libraries/pbrlib/genosl/legacy/mx_subsurface_bsdf.osl @@ -1,4 +1,4 @@ -void mx_subsurface_bsdf(float weight, color _color, vector radius, float anisotropy, normal N, output BSDF bsdf) +void mx_subsurface_bsdf(float weight, color _color, color radius, float anisotropy, normal N, output BSDF bsdf) { // TODO: Subsurface closure is not supported by vanilla OSL. bsdf.response = _color * weight * diffuse(N); diff --git a/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl b/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl index 826eee2bd6..d3e520b137 100644 --- a/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl +++ b/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl @@ -1,4 +1,4 @@ -void mx_subsurface_bsdf(float weight, color _color, vector radius, float anisotropy, normal N, output BSDF bsdf) +void mx_subsurface_bsdf(float weight, color _color, color radius, float anisotropy, normal N, output BSDF bsdf) { // TODO: Subsurface closure is not supported by vanilla OSL. bsdf = _color * weight * diffuse(N); diff --git a/libraries/pbrlib/pbrlib_defs.mtlx b/libraries/pbrlib/pbrlib_defs.mtlx index a64144b66f..2e71f80611 100644 --- a/libraries/pbrlib/pbrlib_defs.mtlx +++ b/libraries/pbrlib/pbrlib_defs.mtlx @@ -117,7 +117,7 @@ - + diff --git a/resources/Materials/TestSuite/pbrlib/surfaceshader/surface_ops.mtlx b/resources/Materials/TestSuite/pbrlib/surfaceshader/surface_ops.mtlx index 8974d4f8d4..825491a45b 100644 --- a/resources/Materials/TestSuite/pbrlib/surfaceshader/surface_ops.mtlx +++ b/resources/Materials/TestSuite/pbrlib/surfaceshader/surface_ops.mtlx @@ -7,7 +7,7 @@ - + diff --git a/source/MaterialXCore/Version.cpp b/source/MaterialXCore/Version.cpp index 5fd7829d56..9c0022bd6a 100644 --- a/source/MaterialXCore/Version.cpp +++ b/source/MaterialXCore/Version.cpp @@ -1130,6 +1130,18 @@ void Document::upgradeVersion() unusedNodes.push_back(top); } } + else if (nodeCategory == "subsurface_bsdf") + { + InputPtr radiusInput = node->getInput("radius"); + if (radiusInput && radiusInput->getType() == "vector3") + { + GraphElementPtr graph = node->getAncestorOfType(); + NodePtr convertNode = graph->addNode("convert", graph->createValidChildName("convert"), "color3"); + copyInputWithBindings(node, "radius", convertNode, "in"); + radiusInput->setConnectedNode(convertNode); + radiusInput->setType("color3"); + } + } else if (nodeCategory == "switch") { // Upgrade switch nodes from 5 to 10 inputs, handling the fallback behavior for diff --git a/source/MaterialXGenMdl/mdl/materialx/pbrlib_1_6.mdl b/source/MaterialXGenMdl/mdl/materialx/pbrlib_1_6.mdl index 5e2e74e733..ef2e090a49 100644 --- a/source/MaterialXGenMdl/mdl/materialx/pbrlib_1_6.mdl +++ b/source/MaterialXGenMdl/mdl/materialx/pbrlib_1_6.mdl @@ -333,7 +333,7 @@ export material mx_generalized_schlick_bsdf( export material mx_subsurface_bsdf( float mxp_weight = 1.0 [[ anno::unused() ]], color mxp_color = color(0.18), - float3 mxp_radius = float3(1.0), // TODO: should probably be a color in MTLX Spec + color mxp_radius = color(1.0), float mxp_anisotropy = 0.0, float3 mxp_normal = state::normal() [[ anno::unused() ]] ) [[ @@ -357,7 +357,7 @@ export material mx_subsurface_bsdf( color alpha = (white - albedo_sq) / (white - mxp_anisotropy * albedo_sq); - color radius_inv = white/color(mxp_radius); + color radius_inv = white / mxp_radius; color sigma_s = alpha * radius_inv; color sigma_a = radius_inv - sigma_s;