Skip to content

Commit

Permalink
Correct impl of screen node
Browse files Browse the repository at this point in the history
The parenthesis were incorrectly placed in the implementation of the
screen compositing node.

Changes from this:
(mix * ((1 - (1 - fg)) * (1 - bg))) + ((1 - mix) * bg)

to this:
(mix * ((1 - (1 - fg) * (1 - bg)))) + ((1 - mix) * bg)
  • Loading branch information
rasmusbonnedal committed Oct 21, 2022
1 parent c689a7b commit 04dae96
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libraries/stdlib/genglsl/mx_screen.inline
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({{mix}}*((1.0 - (1.0 - {{fg}})) * (1.0 - {{bg}}))) + ((1.0-{{mix}})*{{bg}})
({{mix}}*((1.0 - (1.0 - {{fg}}) * (1.0 - {{bg}})))) + ((1.0-{{mix}})*{{bg}})
4 changes: 2 additions & 2 deletions libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@
<implementation name="IM_dodge_color4_genmdl" nodedef="ND_dodge_color4" sourcecode="mx::stdlib::mx_dodge_color4({{fg}}, {{bg}}, {{mix}})" target="genmdl" />

<!-- <screen> -->
<implementation name="IM_screen_float_genmdl" nodedef="ND_screen_float" sourcecode="({{mix}}*((1.0 - (1.0 - {{fg}})) * (1 - {{bg}}))) + ((1.0-{{mix}})*{{bg}})" target="genmdl" />
<implementation name="IM_screen_color3_genmdl" nodedef="ND_screen_color3" sourcecode="({{mix}}*((1.0 - (1.0 - {{fg}})) * (1 - {{bg}}))) + ((1.0-{{mix}})*{{bg}})" target="genmdl" />
<implementation name="IM_screen_float_genmdl" nodedef="ND_screen_float" sourcecode="({{mix}}*((1.0 - (1.0 - {{fg}}) * (1 - {{bg}})))) + ((1.0-{{mix}})*{{bg}})" target="genmdl" />
<implementation name="IM_screen_color3_genmdl" nodedef="ND_screen_color3" sourcecode="({{mix}}*((1.0 - (1.0 - {{fg}}) * (1 - {{bg}})))) + ((1.0-{{mix}})*{{bg}})" target="genmdl" />
<implementation name="IM_screen_color4_genmdl" nodedef="ND_screen_color4" sourcecode="mx::stdlib::mx_screen_color4({{fg}}, {{bg}}, {{mix}})" target="genmdl" />

<!-- <overlay> -->
Expand Down
2 changes: 1 addition & 1 deletion libraries/stdlib/genosl/mx_screen.inline
Original file line number Diff line number Diff line change
@@ -1 +1 @@
({{mix}}*((1.0 - (1.0 - {{fg}})) * (1 - {{bg}}))) + ((1.0-{{mix}})*{{bg}})
({{mix}}*((1.0 - (1.0 - {{fg}}) * (1 - {{bg}})))) + ((1.0-{{mix}})*{{bg}})
4 changes: 2 additions & 2 deletions source/MaterialXGenMdl/mdl/materialx/stdlib.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -2770,8 +2770,8 @@ export color4 mx_screen_color4(
anno::description("Node Group: compositing")
]]
{
color rgb = (mxp_mix*((1.0 - (1.0 - mxp_fg.rgb)) * (1 - mxp_bg.rgb))) + ((1.0-mxp_mix)*mxp_bg.rgb);
float a = (mxp_mix*((1.0 - (1.0 - mxp_fg.a )) * (1 - mxp_bg.a ))) + ((1.0-mxp_mix)*mxp_bg.a );
color rgb = (mxp_mix*((1.0 - (1.0 - mxp_fg.rgb) * (1 - mxp_bg.rgb)))) + ((1.0-mxp_mix)*mxp_bg.rgb);
float a = (mxp_mix*((1.0 - (1.0 - mxp_fg.a ) * (1 - mxp_bg.a )))) + ((1.0-mxp_mix)*mxp_bg.a );
return color4(rgb,a);
}

Expand Down

0 comments on commit 04dae96

Please sign in to comment.