diff --git a/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx b/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx index 39262ae95a..47b95c1990 100644 --- a/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx +++ b/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx @@ -597,10 +597,15 @@ + + + + + diff --git a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx index 24b5099ad2..0f89e7bdcc 100644 --- a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx +++ b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx @@ -605,10 +605,15 @@ + + + + + diff --git a/libraries/stdlib/genosl/include/color4.h b/libraries/stdlib/genosl/include/color4.h index bd05d639a2..78b06b24ec 100644 --- a/libraries/stdlib/genosl/include/color4.h +++ b/libraries/stdlib/genosl/include/color4.h @@ -182,6 +182,12 @@ color4 mix(color4 a, color4 b, float x ) mix(a.a, b.a, x)); } +color4 mix(color4 a, color4 b, color4 x ) +{ + return color4(mix(a.rgb, b.rgb, x.rgb), + mix(a.a, b.a, x.a)); +} + float dot(color4 a, color b) { return dot(a.rgb, b); diff --git a/libraries/stdlib/genosl/include/vector2.h b/libraries/stdlib/genosl/include/vector2.h index 1307ab40ab..f819dd142f 100644 --- a/libraries/stdlib/genosl/include/vector2.h +++ b/libraries/stdlib/genosl/include/vector2.h @@ -181,6 +181,11 @@ vector2 mix(vector2 a, vector2 b, float x ) return vector2 (mix(a.x, b.x, x), mix(a.y, b.y, x)); } +vector2 mix(vector2 a, vector2 b, vector2 x ) +{ + return vector2 (mix(a.x, b.x, x.x), mix(a.y, b.y, x.y)); +} + float dot(vector2 a, vector2 b) { return (a.x * b.x + a.y * b.y); diff --git a/libraries/stdlib/genosl/include/vector4.h b/libraries/stdlib/genosl/include/vector4.h index 667b001120..56b64b0c6a 100644 --- a/libraries/stdlib/genosl/include/vector4.h +++ b/libraries/stdlib/genosl/include/vector4.h @@ -208,6 +208,14 @@ vector4 mix(vector4 value1, vector4 value2, float x ) mix( value1.w, value2.w, x)); } +vector4 mix(vector4 value1, vector4 value2, vector4 x ) +{ + return vector4 (mix( value1.x, value2.x, x.x), + mix( value1.y, value2.y, x.y), + mix( value1.z, value2.z, x.z), + mix( value1.w, value2.w, x.w)); +} + vector vec4ToVec3(vector4 v) { return vector(v.x, v.y, v.z) / v.w; diff --git a/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx b/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx index 1677aecc1c..b7a1b0363c 100644 --- a/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx +++ b/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx @@ -602,10 +602,15 @@ + + + + + diff --git a/libraries/stdlib/stdlib_defs.mtlx b/libraries/stdlib/stdlib_defs.mtlx index 000344868c..d1f8c29468 100644 --- a/libraries/stdlib/stdlib_defs.mtlx +++ b/libraries/stdlib/stdlib_defs.mtlx @@ -3222,30 +3222,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/Materials/TestSuite/stdlib/compositing/compositing.mtlx b/resources/Materials/TestSuite/stdlib/compositing/compositing.mtlx index a2bd7d9a24..e7a742c581 100644 --- a/resources/Materials/TestSuite/stdlib/compositing/compositing.mtlx +++ b/resources/Materials/TestSuite/stdlib/compositing/compositing.mtlx @@ -282,11 +282,19 @@ - + + + + + + + + + - + @@ -298,6 +306,14 @@ + + + + + + + + @@ -306,6 +322,14 @@ + + + + + + + + @@ -314,6 +338,14 @@ + + + + + + + + diff --git a/source/MaterialXGenMdl/mdl/materialx/stdlib.mdl b/source/MaterialXGenMdl/mdl/materialx/stdlib.mdl index 1e4db85eed..c7572f854b 100644 --- a/source/MaterialXGenMdl/mdl/materialx/stdlib.mdl +++ b/source/MaterialXGenMdl/mdl/materialx/stdlib.mdl @@ -3049,6 +3049,18 @@ export color4 mx_mix_color4( return mk_color4(::math::lerp(mk_float4(mxp_bg), mk_float4(mxp_fg), float4(mxp_mix))); } +export color4 mx_mix_color4_color4( + color4 mxp_fg = mk_color4(0.0, 0.0, 0.0, 0.0), + color4 mxp_bg = mk_color4(0.0, 0.0, 0.0, 0.0), + color4 mxp_mix = mk_color4(0.0, 0.0, 0.0, 0.0) +) + [[ + anno::description("Node Group: compositing") + ]] +{ + return mk_color4(::math::lerp(mk_float4(mxp_bg), mk_float4(mxp_fg), mk_float4(mxp_mix))); +} + export material mx_mix_surfaceshader( material mxp_fg [[ anno::unused() ]], material mxp_bg,