Skip to content

Commit 0415e58

Browse files
Additional optimization to glTF PBR graph (AcademySoftwareFoundation#2493)
This changelist implements one additional optimization to the graph for glTF PBR, ensuring that the render cost of the transmissive `dielectric_bsdf` node can be skipped for materials with no transmissive component. Performance tests were conducted on an NVIDIA RTX A6000 at 4K resolution, and the following timing improvements were seen: glTF PBR Carpaint: 11ms -> 8ms glTF PBR Plastic: 8ms -> 5ms glTF PBR Gold: 9ms -> 6ms glTF PBR Boombox: 4ms -> 3ms
1 parent 9d31418 commit 0415e58

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

libraries/bxdf/gltf_pbr.mtlx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,27 @@
135135
</mix>
136136

137137
<!-- Dielectric -->
138+
<invert name="transmission_inv" type="float">
139+
<input name="in" type="float" interfacename="transmission" />
140+
</invert>
138141
<oren_nayar_diffuse_bsdf name="diffuse_bsdf" type="BSDF">
142+
<input name="weight" type="float" nodename="transmission_inv" />
139143
<input name="color" type="color3" interfacename="base_color" />
140144
<input name="normal" type="vector3" interfacename="normal" />
141145
</oren_nayar_diffuse_bsdf>
142146
<dielectric_bsdf name="transmission_bsdf" type="BSDF">
143-
<input name="weight" type="float" value="1" />
147+
<input name="weight" type="float" interfacename="transmission" />
144148
<input name="tint" type="color3" interfacename="base_color" />
145149
<input name="ior" type="float" interfacename="ior" />
146150
<input name="roughness" type="vector2" nodename="roughness_uv" />
147151
<input name="normal" type="vector3" interfacename="normal" />
148152
<input name="tangent" type="vector3" nodename="selected_tangent" />
149153
<input name="scatter_mode" type="string" value="T" />
150154
</dielectric_bsdf>
151-
<mix name="transmission_mix" type="BSDF">
152-
<input name="bg" type="BSDF" nodename="diffuse_bsdf" />
153-
<input name="fg" type="BSDF" nodename="transmission_bsdf" />
154-
<input name="mix" type="float" interfacename="transmission" />
155-
</mix>
155+
<add name="transmission_blend" type="BSDF">
156+
<input name="in1" type="BSDF" nodename="diffuse_bsdf" />
157+
<input name="in2" type="BSDF" nodename="transmission_bsdf" />
158+
</add>
156159
<invert name="iridescence_inv" type="float">
157160
<input name="in" type="float" interfacename="iridescence" />
158161
</invert>
@@ -182,7 +185,7 @@
182185
</add>
183186
<layer name="dielectric_layer" type="BSDF">
184187
<input name="top" type="BSDF" nodename="reflection_bsdf_blend" />
185-
<input name="base" type="BSDF" nodename="transmission_mix" />
188+
<input name="base" type="BSDF" nodename="transmission_blend" />
186189
</layer>
187190

188191
<!-- Metal -->

0 commit comments

Comments
 (0)