Skip to content

Commit c52561b

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into functional_nodedefs
2 parents 8ef6904 + 59f98fe commit c52561b

10 files changed

Lines changed: 1960 additions & 104 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Added support for [hex-tiled images](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2094), with initial implementations in hardware shading languages and MDL.
88
- Added support for [latitude-longitude images](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2168), implemented as a language-independent graph.
99
- Added support for [2D fractals](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2183), with initial implementations in hardware shading languages, OSL, and MDL.
10+
- Added support for [NanoColor names](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2513) in default color space management.
1011
- Added support for [custom OCIO configurations](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1917) in shader generation.
1112
- Added support for [anisotropy](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2393) in the graph definition of glTF PBR.
1213
- Added support for the [time and frame nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2389) in the MaterialX Viewer and MaterialX Graph Editor.
@@ -18,7 +19,7 @@
1819
- Raised the minimum Python version to [Python 3.9](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2326).
1920
- Raised the minimum OpenImageIO version to [OIIO 2.2](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2340).
2021
- Raised the default PyBind11 version to [PyBind11 2.13.6](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2331).
21-
- Optimized the graph definitions of [Standard Surface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2483), [OpenPBR Surface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2459), and [glTF PBR](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2467), roughly halving the fill cost for these shading models in hardware shading languages.
22+
- Optimized the graph definitions of [Standard Surface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2483), [OpenPBR Surface](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2459), and [glTF PBR](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2467) in hardware shading languages, roughly halving the fill cost for these shading models in GLSL, ESSL, and MSL.
2223
- Optimized the implementation of [height-correlated Smith masking-shadowing](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2458) in GLSL.
2324
- Aligned implementations of the [heighttonormal node](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2424) beween GLSL and OSL, improving visual consistency and enabling support for arbitrary procedural heightfields.
2425
- Deprecated the [fps input](https://github.com/AcademySoftwareFoundation/MaterialX/pull/2450) of the time node, allowing it to be removed in a future specification update.
Lines changed: 330 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,330 @@
1+
<?xml version="1.0"?>
2+
<materialx version="1.39">
3+
<!-- An optimized graph implementation for hardware shading languages,
4+
improving the effectiveness of dynamic branches. -->
5+
6+
<nodegraph name="IMPL_gltf_pbr_surfaceshader_optim" nodedef="ND_gltf_pbr_surfaceshader" target="genglsl">
7+
8+
<!-- Volume -->
9+
10+
<convert name="attenuation_color_vec" type="vector3">
11+
<input name="in" type="color3" interfacename="attenuation_color" />
12+
</convert>
13+
14+
<ln name="ln_attenuation_color_vec" type="vector3">
15+
<input name="in" type="vector3" nodename="attenuation_color_vec" />
16+
</ln>
17+
18+
<divide name="ln_attenuation_color_vec_over_distance" type="vector3">
19+
<input name="in1" type="vector3" nodename="ln_attenuation_color_vec" />
20+
<input name="in2" type="float" interfacename="attenuation_distance" />
21+
</divide>
22+
23+
<multiply name="attenuation_coeff" type="vector3">
24+
<input name="in1" type="vector3" nodename="ln_attenuation_color_vec_over_distance" />
25+
<input name="in2" type="float" value="-1" />
26+
</multiply>
27+
28+
<anisotropic_vdf name="isotropic_volume" type="VDF">
29+
<!-- No scattering yet, so absorption_coeff == attenuation_coeff -->
30+
<input name="absorption" type="vector3" nodename="attenuation_coeff" />
31+
<input name="scattering" type="vector3" value="0, 0, 0" />
32+
<input name="anisotropy" type="float" value="0" />
33+
</anisotropic_vdf>
34+
35+
<!-- Base layer -->
36+
37+
<!-- Compute F0 and F90 of dielectric component -->
38+
<subtract name="one_minus_ior" type="float">
39+
<input name="in1" type="float" value="1" />
40+
<input name="in2" type="float" interfacename="ior" />
41+
</subtract>
42+
43+
<add name="one_plus_ior" type="float">
44+
<input name="in1" type="float" value="1" />
45+
<input name="in2" type="float" interfacename="ior" />
46+
</add>
47+
48+
<divide name="ior_div" type="float">
49+
<input name="in1" type="float" nodename="one_minus_ior" />
50+
<input name="in2" type="float" nodename="one_plus_ior" />
51+
</divide>
52+
53+
<multiply name="dielectric_f0_from_ior" type="float">
54+
<input name="in1" type="float" nodename="ior_div" />
55+
<input name="in2" type="float" nodename="ior_div" />
56+
</multiply>
57+
58+
<multiply name="dielectric_f0_from_ior_specular_color" type="color3">
59+
<input name="in1" type="color3" interfacename="specular_color" />
60+
<input name="in2" type="float" nodename="dielectric_f0_from_ior" />
61+
</multiply>
62+
63+
<min name="clamped_dielectric_f0_from_ior_specular_color" type="color3">
64+
<input name="in1" type="color3" nodename="dielectric_f0_from_ior_specular_color" />
65+
<input name="in2" type="float" value="1" />
66+
</min>
67+
68+
<multiply name="dielectric_f0" type="color3">
69+
<input name="in1" type="color3" nodename="clamped_dielectric_f0_from_ior_specular_color" />
70+
<input name="in2" type="float" interfacename="specular" />
71+
</multiply>
72+
73+
<multiply name="dielectric_f90" type="color3">
74+
<input name="in1" type="color3" value="1, 1, 1" />
75+
<input name="in2" type="float" interfacename="specular" />
76+
</multiply>
77+
78+
<!-- Roughness -->
79+
80+
<combine2 name="roughness_uv" type="vector2">
81+
<input name="in1" type="float" nodename="clamped_at" />
82+
<input name="in2" type="float" nodename="clamped_ab" />
83+
</combine2>
84+
<clamp name="clamped_at" type="float">
85+
<input name="in" type="float" nodename="at" />
86+
<input name="low" type="float" value="0.00001" />
87+
<input name="high" type="float" value="1.0" />
88+
</clamp>
89+
<clamp name="clamped_ab" type="float">
90+
<input name="in" type="float" nodename="alpha_roughness" />
91+
<input name="low" type="float" value="0.00001" />
92+
<input name="high" type="float" value="1.0" />
93+
</clamp>
94+
<multiply name="alpha_roughness" type="float">
95+
<input name="in1" type="float" interfacename="roughness" />
96+
<input name="in2" type="float" interfacename="roughness" />
97+
</multiply>
98+
<multiply name="strength_2" type="float">
99+
<input name="in1" type="float" interfacename="anisotropy_strength" />
100+
<input name="in2" type="float" interfacename="anisotropy_strength" />
101+
</multiply>
102+
<mix name="at" type="float">
103+
<input name="fg" type="float" value="1" />
104+
<input name="bg" type="float" nodename="alpha_roughness" />
105+
<input name="mix" type="float" nodename="strength_2" />
106+
</mix>
107+
108+
<!-- Dielectric -->
109+
<invert name="transmission_inv" type="float">
110+
<input name="in" type="float" interfacename="transmission" />
111+
</invert>
112+
<oren_nayar_diffuse_bsdf name="diffuse_bsdf" type="BSDF">
113+
<input name="weight" type="float" nodename="transmission_inv" />
114+
<input name="color" type="color3" interfacename="base_color" />
115+
<input name="normal" type="vector3" interfacename="normal" />
116+
</oren_nayar_diffuse_bsdf>
117+
<dielectric_bsdf name="transmission_bsdf" type="BSDF">
118+
<input name="weight" type="float" interfacename="transmission" />
119+
<input name="tint" type="color3" interfacename="base_color" />
120+
<input name="ior" type="float" interfacename="ior" />
121+
<input name="roughness" type="vector2" nodename="roughness_uv" />
122+
<input name="normal" type="vector3" interfacename="normal" />
123+
<input name="tangent" type="vector3" nodename="selected_tangent" />
124+
<input name="scatter_mode" type="string" value="T" />
125+
</dielectric_bsdf>
126+
<add name="transmission_blend" type="BSDF">
127+
<input name="in1" type="BSDF" nodename="diffuse_bsdf" />
128+
<input name="in2" type="BSDF" nodename="transmission_bsdf" />
129+
</add>
130+
<invert name="iridescence_inv" type="float">
131+
<input name="in" type="float" interfacename="iridescence" />
132+
</invert>
133+
<generalized_schlick_bsdf name="reflection_bsdf" type="BSDF">
134+
<input name="weight" type="float" nodename="iridescence_inv" />
135+
<input name="color0" type="color3" nodename="dielectric_f0" />
136+
<input name="color90" type="color3" nodename="dielectric_f90" />
137+
<input name="roughness" type="vector2" nodename="roughness_uv" />
138+
<input name="normal" type="vector3" interfacename="normal" />
139+
<input name="tangent" type="vector3" nodename="selected_tangent" />
140+
<input name="scatter_mode" type="string" value="R" />
141+
</generalized_schlick_bsdf>
142+
<generalized_schlick_bsdf name="reflection_bsdf_tf" type="BSDF">
143+
<input name="weight" type="float" interfacename="iridescence" />
144+
<input name="color0" type="color3" nodename="dielectric_f0" />
145+
<input name="color90" type="color3" nodename="dielectric_f90" />
146+
<input name="roughness" type="vector2" nodename="roughness_uv" />
147+
<input name="normal" type="vector3" interfacename="normal" />
148+
<input name="tangent" type="vector3" nodename="selected_tangent" />
149+
<input name="scatter_mode" type="string" value="R" />
150+
<input name="thinfilm_thickness" type="float" interfacename="iridescence_thickness" />
151+
<input name="thinfilm_ior" type="float" interfacename="iridescence_ior" />
152+
</generalized_schlick_bsdf>
153+
<add name="reflection_bsdf_blend" type="BSDF">
154+
<input name="in1" type="BSDF" nodename="reflection_bsdf" />
155+
<input name="in2" type="BSDF" nodename="reflection_bsdf_tf" />
156+
</add>
157+
<layer name="dielectric_layer" type="BSDF">
158+
<input name="top" type="BSDF" nodename="reflection_bsdf_blend" />
159+
<input name="base" type="BSDF" nodename="transmission_blend" />
160+
</layer>
161+
162+
<!-- Metal -->
163+
<generalized_schlick_bsdf name="metal_bsdf" type="BSDF">
164+
<input name="weight" type="float" nodename="iridescence_inv" />
165+
<input name="color0" type="color3" interfacename="base_color" />
166+
<input name="color90" type="color3" value="1, 1, 1" />
167+
<input name="roughness" type="vector2" nodename="roughness_uv" />
168+
<input name="normal" type="vector3" interfacename="normal" />
169+
<input name="tangent" type="vector3" nodename="selected_tangent" />
170+
</generalized_schlick_bsdf>
171+
<generalized_schlick_bsdf name="metal_bsdf_tf" type="BSDF">
172+
<input name="weight" type="float" interfacename="iridescence" />
173+
<input name="color0" type="color3" interfacename="base_color" />
174+
<input name="color90" type="color3" value="1, 1, 1" />
175+
<input name="roughness" type="vector2" nodename="roughness_uv" />
176+
<input name="normal" type="vector3" interfacename="normal" />
177+
<input name="tangent" type="vector3" nodename="selected_tangent" />
178+
<input name="thinfilm_thickness" type="float" interfacename="iridescence_thickness" />
179+
<input name="thinfilm_ior" type="float" interfacename="iridescence_ior" />
180+
</generalized_schlick_bsdf>
181+
<add name="metal_blend" type="BSDF">
182+
<input name="in1" type="BSDF" nodename="metal_bsdf" />
183+
<input name="in2" type="BSDF" nodename="metal_bsdf_tf" />
184+
</add>
185+
186+
<!-- Dielectric/metal mix -->
187+
<mix name="base_mix" type="BSDF">
188+
<input name="bg" type="BSDF" nodename="dielectric_layer" />
189+
<input name="fg" type="BSDF" nodename="metal_blend" />
190+
<input name="mix" type="float" interfacename="metallic" />
191+
</mix>
192+
193+
<!-- Sheen layer -->
194+
195+
<!-- Compute sheen intensity = max(sheen_color.r, sheen_color.g, sheen_color.b) -->
196+
<extract name="sheen_color_r" type="float">
197+
<input name="in" type="color3" interfacename="sheen_color" />
198+
<input name="index" type="integer" value="0" />
199+
</extract>
200+
201+
<extract name="sheen_color_g" type="float">
202+
<input name="in" type="color3" interfacename="sheen_color" />
203+
<input name="index" type="integer" value="1" />
204+
</extract>
205+
206+
<extract name="sheen_color_b" type="float">
207+
<input name="in" type="color3" interfacename="sheen_color" />
208+
<input name="index" type="integer" value="2" />
209+
</extract>
210+
211+
<max name="sheen_color_max_rg" type="float">
212+
<input name="in1" type="float" nodename="sheen_color_r" />
213+
<input name="in2" type="float" nodename="sheen_color_g" />
214+
</max>
215+
216+
<max name="sheen_intensity" type="float">
217+
<input name="in1" type="float" nodename="sheen_color_max_rg" />
218+
<input name="in2" type="float" nodename="sheen_color_b" />
219+
</max>
220+
221+
<multiply name="sheen_roughness_sq" type="float">
222+
<input name="in1" type="float" interfacename="sheen_roughness" />
223+
<input name="in2" type="float" interfacename="sheen_roughness" />
224+
</multiply>
225+
226+
<divide name="sheen_color_normalized" type="color3">
227+
<input name="in1" type="color3" interfacename="sheen_color" />
228+
<input name="in2" type="float" nodename="sheen_intensity" />
229+
</divide>
230+
231+
<sheen_bsdf name="sheen_bsdf" type="BSDF">
232+
<input name="weight" type="float" nodename="sheen_intensity" />
233+
<input name="color" type="color3" nodename="sheen_color_normalized" />
234+
<input name="roughness" type="float" nodename="sheen_roughness_sq" />
235+
<input name="normal" type="vector3" interfacename="normal" />
236+
</sheen_bsdf>
237+
238+
<layer name="sheen_layer" type="BSDF">
239+
<input name="top" type="BSDF" nodename="sheen_bsdf" />
240+
<input name="base" type="BSDF" nodename="base_mix" />
241+
</layer>
242+
243+
<!-- Clearcoat -->
244+
245+
<roughness_anisotropy name="clearcoat_roughness_uv" type="vector2">
246+
<input name="roughness" type="float" interfacename="clearcoat_roughness" />
247+
</roughness_anisotropy>
248+
249+
<dielectric_bsdf name="clearcoat_bsdf" type="BSDF">
250+
<input name="weight" type="float" interfacename="clearcoat" />
251+
<input name="roughness" type="vector2" nodename="clearcoat_roughness_uv" />
252+
<input name="ior" type="float" value="1.5" />
253+
<input name="normal" type="vector3" interfacename="clearcoat_normal" />
254+
<input name="tangent" type="vector3" interfacename="tangent" />
255+
</dielectric_bsdf>
256+
257+
<layer name="clearcoat_layer" type="BSDF">
258+
<input name="top" type="BSDF" nodename="clearcoat_bsdf" />
259+
<input name="base" type="BSDF" nodename="sheen_layer" />
260+
</layer>
261+
262+
<!-- Emission -->
263+
264+
<multiply name="emission_color" type="color3">
265+
<input name="in1" type="color3" interfacename="emissive" />
266+
<input name="in2" type="float" interfacename="emissive_strength" />
267+
</multiply>
268+
269+
<uniform_edf name="emission" type="EDF">
270+
<input name="color" type="color3" nodename="emission_color" />
271+
</uniform_edf>
272+
273+
<!-- Alpha -->
274+
275+
<ifgreatereq name="opacity_mask_cutoff" type="float">
276+
<input name="value1" type="float" interfacename="alpha" />
277+
<input name="value2" type="float" interfacename="alpha_cutoff" />
278+
<input name="in1" type="float" value="1" />
279+
<input name="in2" type="float" value="0" />
280+
</ifgreatereq>
281+
282+
<ifequal name="opacity_mask" type="float">
283+
<input name="value1" type="integer" interfacename="alpha_mode" />
284+
<input name="value2" type="integer" value="1" />
285+
<input name="in1" type="float" nodename="opacity_mask_cutoff" />
286+
<input name="in2" type="float" interfacename="alpha" />
287+
</ifequal>
288+
289+
<ifequal name="opacity" type="float">
290+
<input name="value1" type="integer" interfacename="alpha_mode" />
291+
<input name="value2" type="integer" value="0" />
292+
<input name="in1" type="float" value="1" />
293+
<input name="in2" type="float" nodename="opacity_mask" />
294+
</ifequal>
295+
296+
<!-- Anisotropy -->
297+
298+
<multiply name="rad_2_deg" type="float">
299+
<input name="in1" type="float" interfacename="anisotropy_rotation" />
300+
<input name="in2" type="float" value="-57.295780" />
301+
</multiply>
302+
<rotate3d name="rotate_tangent" type="vector3">
303+
<input name="in" type="vector3" interfacename="tangent" />
304+
<input name="amount" type="float" nodename="rad_2_deg" />
305+
<input name="axis" type="vector3" interfacename="normal" />
306+
</rotate3d>
307+
<normalize name="normalize_tangent" type="vector3">
308+
<input name="in" type="vector3" nodename="rotate_tangent" />
309+
</normalize>
310+
<absval name="abs_anisotropy_rotation" type="float">
311+
<input name="in" type="float" interfacename="anisotropy_rotation"/>
312+
</absval>
313+
<ifgreater name="selected_tangent" type="vector3">
314+
<input name="value1" type="float" nodename="abs_anisotropy_rotation" />
315+
<input name="value2" type="float" value="0.0" />
316+
<input name="in1" type="vector3" nodename="normalize_tangent" />
317+
<input name="in2" type="vector3" interfacename="tangent" />
318+
</ifgreater>
319+
320+
<!-- Surface -->
321+
322+
<surface name="shader_constructor" type="surfaceshader">
323+
<input name="bsdf" type="BSDF" nodename="clearcoat_layer" />
324+
<input name="edf" type="EDF" nodename="emission" />
325+
<input name="opacity" type="float" nodename="opacity" />
326+
</surface>
327+
<output name="out" type="surfaceshader" nodename="shader_constructor" />
328+
</nodegraph>
329+
330+
</materialx>

0 commit comments

Comments
 (0)