Skip to content

Commit 2271cc3

Browse files
committed
explicitly clamp subsurface_color to 0->1 range (#270)
1 parent 34b2b22 commit 2271cc3

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

reference/open_pbr_surface.mtlx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,18 @@
135135
</open_pbr_anisotropy>
136136

137137
<!-- Subsurface (thin-walled) -->
138-
<max name="subsurface_color_nonnegative" type="color3">
139-
<input name="in1" type="color3" interfacename="subsurface_color" />
140-
<input name="in2" type="float" value="0.0" />
141-
</max>
138+
<clamp name="subsurface_color_clamped" type="color3">
139+
<input name="in" type="color3" interfacename="subsurface_color" />
140+
<input name="low" type="color3" value="0.0, 0.0, 0.0" />
141+
<input name="high" type="color3" value="1.0, 1.0, 1.0" />
142+
</clamp>
142143
<oren_nayar_diffuse_bsdf name="subsurface_thin_walled_reflection_bsdf" type="BSDF">
143-
<input name="color" type="color3" nodename="subsurface_color_nonnegative" />
144+
<input name="color" type="color3" nodename="subsurface_color_clamped" />
144145
<input name="roughness" type="float" interfacename="base_diffuse_roughness" />
145146
<input name="normal" type="vector3" interfacename="geometry_normal" />
146147
</oren_nayar_diffuse_bsdf>
147148
<translucent_bsdf name="subsurface_thin_walled_transmission_bsdf" type="BSDF">
148-
<input name="color" type="color3" nodename="subsurface_color_nonnegative" />
149+
<input name="color" type="color3" nodename="subsurface_color_clamped" />
149150
<input name="normal" type="vector3" interfacename="geometry_normal" />
150151
</translucent_bsdf>
151152
<subtract name="one_minus_subsurface_scatter_anisotropy" type="float">
@@ -168,7 +169,7 @@
168169
<input name="in2" type="float" interfacename="subsurface_radius" />
169170
</multiply>
170171
<subsurface_bsdf name="subsurface_bsdf" type="BSDF">
171-
<input name="color" type="color3" nodename="subsurface_color_nonnegative" />
172+
<input name="color" type="color3" nodename="subsurface_color_clamped" />
172173
<input name="radius" type="color3" nodename="subsurface_radius_scaled" />
173174
<input name="anisotropy" type="float" interfacename="subsurface_scatter_anisotropy" />
174175
<input name="normal" type="vector3" interfacename="geometry_normal" />

0 commit comments

Comments
 (0)