Skip to content

Commit 308c7d0

Browse files
Fix GLSL implementation of layer node (#2368)
This changelist fixes a typo in the GLSL implementation of the `layer` node, where the throughput term was computed via addition rather than multiplication. For more straightforward validation, the `layer_bsdf.mtlx` example has been updated so that the throughput computation in `layer` influences its rendered result.
1 parent 655bd40 commit 308c7d0

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

libraries/pbrlib/genglsl/mx_layer_bsdf.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
void mx_layer_bsdf(ClosureData closureData, BSDF top, BSDF base, out BSDF result)
44
{
55
result.response = top.response + base.response * top.throughput;
6-
result.throughput = top.throughput + base.throughput;
6+
result.throughput = top.throughput * base.throughput;
77
}

resources/Materials/TestSuite/pbrlib/bsdf/layer_bsdf.mtlx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
<input name="tint" type="color3" value="1,0,0" />
1212
</dielectric_bsdf>
1313
<layer name="layer_bsdf_1" type="BSDF">
14-
<input name="top" type="BSDF" nodename="sheen_brdf_1" />
15-
<input name="base" type="BSDF" nodename="diffuse_brdf_1" />
14+
<input name="top" type="BSDF" nodename="dielectric_brdf_2" />
15+
<input name="base" type="BSDF" nodename="dielectric_brdf_1" />
1616
</layer>
1717
<layer name="layer_bsdf_2" type="BSDF">
18-
<input name="top" type="BSDF" nodename="dielectric_brdf_1" />
19-
<input name="base" type="BSDF" nodename="layer_bsdf_1" />
18+
<input name="top" type="BSDF" nodename="layer_bsdf_1" />
19+
<input name="base" type="BSDF" nodename="sheen_brdf_1" />
2020
</layer>
2121
<layer name="layer_bsdf_3" type="BSDF">
22-
<input name="top" type="BSDF" nodename="dielectric_brdf_2" />
23-
<input name="base" type="BSDF" nodename="layer_bsdf_2" />
22+
<input name="top" type="BSDF" nodename="layer_bsdf_2" />
23+
<input name="base" type="BSDF" nodename="diffuse_brdf_1" />
2424
</layer>
2525
<surface name="surface1" type="surfaceshader">
2626
<input name="bsdf" type="BSDF" nodename="layer_bsdf_3" />

0 commit comments

Comments
 (0)