Skip to content

Commit 3845bc1

Browse files
authored
MaterialX: fix bug in thin-walled subsurface (#251)
As pointed out by Brian Sharpe of SideFX, there is a bug in the thin-walled subsurface, since `specular_color` is accounted for in both the BSDF weights and as an explicit multiplier. Also, the graph can be simplified a bit using the mix operation with a more carefully chosen weight.
1 parent 4b602eb commit 3845bc1

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

reference/open_pbr_surface.mtlx

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -144,38 +144,22 @@
144144
<input name="roughness" type="float" interfacename="base_diffuse_roughness" />
145145
<input name="normal" type="vector3" interfacename="geometry_normal" />
146146
</oren_nayar_diffuse_bsdf>
147-
<subtract name="one_minus_subsurface_scatter_anisotropy" type="float">
148-
<input name="in1" type="float" value="1.0" />
149-
<input name="in2" type="float" interfacename="subsurface_scatter_anisotropy" />
150-
</subtract>
151-
<multiply name="subsurface_thin_walled_brdf_factor" type="color3">
152-
<input name="in1" type="color3" interfacename="subsurface_color" />
153-
<input name="in2" type="float" nodename="one_minus_subsurface_scatter_anisotropy" />
154-
</multiply>
155-
<multiply name="subsurface_thin_walled_reflection" type="BSDF">
156-
<input name="in1" type="BSDF" nodename="subsurface_thin_walled_reflection_bsdf" />
157-
<input name="in2" type="color3" nodename="subsurface_thin_walled_brdf_factor" />
158-
</multiply>
159147
<translucent_bsdf name="subsurface_thin_walled_transmission_bsdf" type="BSDF">
160148
<input name="color" type="color3" nodename="subsurface_color_nonnegative" />
161149
<input name="normal" type="vector3" interfacename="geometry_normal" />
162150
</translucent_bsdf>
163-
<add name="one_plus_subsurface_scatter_anisotropy" type="float">
151+
<subtract name="one_minus_subsurface_scatter_anisotropy" type="float">
164152
<input name="in1" type="float" value="1.0" />
165153
<input name="in2" type="float" interfacename="subsurface_scatter_anisotropy" />
166-
</add>
167-
<multiply name="subsurface_thin_walled_btdf_factor" type="color3">
168-
<input name="in1" type="color3" interfacename="subsurface_color" />
169-
<input name="in2" type="float" nodename="one_plus_subsurface_scatter_anisotropy" />
170-
</multiply>
171-
<multiply name="subsurface_thin_walled_transmission" type="BSDF">
172-
<input name="in1" type="BSDF" nodename="subsurface_thin_walled_transmission_bsdf" />
173-
<input name="in2" type="color3" nodename="subsurface_thin_walled_btdf_factor" />
154+
</subtract>
155+
<multiply name="subsurface_thin_walled_brdf_mix_factor" type="float">
156+
<input name="in1" type="float" value="0.5" />
157+
<input name="in2" type="float" nodename="one_minus_subsurface_scatter_anisotropy" />
174158
</multiply>
175159
<mix name="subsurface_thin_walled" type="BSDF">
176-
<input name="fg" type="BSDF" nodename="subsurface_thin_walled_reflection" />
177-
<input name="bg" type="BSDF" nodename="subsurface_thin_walled_transmission" />
178-
<input name="mix" type="float" value="0.5" />
160+
<input name="fg" type="BSDF" nodename="subsurface_thin_walled_reflection_bsdf" />
161+
<input name="bg" type="BSDF" nodename="subsurface_thin_walled_transmission_bsdf" />
162+
<input name="mix" type="float" nodename="subsurface_thin_walled_brdf_mix_factor" />
179163
</mix>
180164

181165
<!-- Subsurface (non-thin-walled) -->

0 commit comments

Comments
 (0)