Skip to content

Commit 0c1ed1e

Browse files
authored
Fixes for MaterialX format checker (AcademySoftwareFoundation#2647)
## Changes The utility `mx_format.py` was not traversing to sub-folders so when applied to `libraries` it would miss some files. This fixes some files which had invalid XML (unescaped characters) as `PugiXML` will "fix" this on write. Two additional options have been added: - Check for XML syntax validity - MaterialX validation checking Both are off by default. ## Results - Ran this again `libraries` folder. Changes are mostly cosmetic except for the mentioned fixes to missed files. - Ran this against `resources` folder. Found a file which had duplicate elements. Fixed manually.
1 parent 0062647 commit 0c1ed1e

18 files changed

Lines changed: 275 additions & 251 deletions

libraries/bxdf/genglsl/gltf_pbr.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
<input name="in" type="vector3" nodename="rotate_tangent" />
309309
</normalize>
310310
<absval name="abs_anisotropy_rotation" type="float">
311-
<input name="in" type="float" interfacename="anisotropy_rotation"/>
311+
<input name="in" type="float" interfacename="anisotropy_rotation" />
312312
</absval>
313313
<ifgreater name="selected_tangent" type="vector3">
314314
<input name="value1" type="float" nodename="abs_anisotropy_rotation" />

libraries/bxdf/genglsl/open_pbr_surface.mtlx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,21 @@
211211
</multiply>
212212

213213
<!-- Dielectric Base -->
214-
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
215-
<divide name="specular_to_coat_ior_ratio" type="float">
216-
<input name="in1" type="float" interfacename="specular_ior" />
217-
<input name="in2" type="float" interfacename="coat_ior" />
218-
</divide>
219-
<divide name="coat_to_specular_ior_ratio" type="float">
220-
<input name="in1" type="float" interfacename="coat_ior" />
221-
<input name="in2" type="float" interfacename="specular_ior" />
222-
</divide>
223-
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
224-
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
225-
<input name="value2" type="float" value="1.0" />
226-
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
227-
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
228-
</ifgreater>
214+
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
215+
<divide name="specular_to_coat_ior_ratio" type="float">
216+
<input name="in1" type="float" interfacename="specular_ior" />
217+
<input name="in2" type="float" interfacename="coat_ior" />
218+
</divide>
219+
<divide name="coat_to_specular_ior_ratio" type="float">
220+
<input name="in1" type="float" interfacename="coat_ior" />
221+
<input name="in2" type="float" interfacename="specular_ior" />
222+
</divide>
223+
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
224+
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
225+
<input name="value2" type="float" value="1.0" />
226+
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
227+
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
228+
</ifgreater>
229229
<mix name="eta_s" type="float">
230230
<input name="fg" type="float" nodename="specular_to_coat_ior_ratio_tir_fix" />
231231
<input name="bg" type="float" interfacename="specular_ior" />
@@ -546,8 +546,7 @@
546546
<!--
547547
OpenPBR Anisotropy node definition
548548
-->
549-
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr"
550-
doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
549+
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr" doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
551550
<input name="roughness" type="float" value="0.0" />
552551
<input name="anisotropy" type="float" value="0.0" />
553552
<output name="out" type="vector2" />

libraries/bxdf/genmdl/open_pbr_surface.mtlx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,21 @@
210210
</multiply>
211211

212212
<!-- Dielectric Base -->
213-
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
214-
<divide name="specular_to_coat_ior_ratio" type="float">
215-
<input name="in1" type="float" interfacename="specular_ior" />
216-
<input name="in2" type="float" interfacename="coat_ior" />
217-
</divide>
218-
<divide name="coat_to_specular_ior_ratio" type="float">
219-
<input name="in1" type="float" interfacename="coat_ior" />
220-
<input name="in2" type="float" interfacename="specular_ior" />
221-
</divide>
222-
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
223-
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
224-
<input name="value2" type="float" value="1.0" />
225-
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
226-
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
227-
</ifgreater>
213+
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
214+
<divide name="specular_to_coat_ior_ratio" type="float">
215+
<input name="in1" type="float" interfacename="specular_ior" />
216+
<input name="in2" type="float" interfacename="coat_ior" />
217+
</divide>
218+
<divide name="coat_to_specular_ior_ratio" type="float">
219+
<input name="in1" type="float" interfacename="coat_ior" />
220+
<input name="in2" type="float" interfacename="specular_ior" />
221+
</divide>
222+
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
223+
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
224+
<input name="value2" type="float" value="1.0" />
225+
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
226+
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
227+
</ifgreater>
228228
<mix name="eta_s" type="float">
229229
<input name="fg" type="float" nodename="specular_to_coat_ior_ratio_tir_fix" />
230230
<input name="bg" type="float" interfacename="specular_ior" />
@@ -326,7 +326,7 @@
326326
<layer name="dielectric_base_tf" type="BSDF">
327327
<input name="top" type="BSDF" nodename="dielectric_reflection_tf" />
328328
<input name="base" type="BSDF" nodename="dielectric_substrate" />
329-
</layer >
329+
</layer>
330330
<layer name="dielectric_base_notf" type="BSDF">
331331
<input name="top" type="BSDF" nodename="dielectric_reflection" />
332332
<input name="base" type="BSDF" nodename="dielectric_substrate" />
@@ -543,8 +543,7 @@
543543
<!--
544544
OpenPBR Anisotropy node definition
545545
-->
546-
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr"
547-
doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
546+
<nodedef name="ND_open_pbr_anisotropy" node="open_pbr_anisotropy" nodegroup="pbr" doc="Computes anisotropic surface roughness as defined in the OpenPBR specification.">
548547
<input name="roughness" type="float" value="0.0" />
549548
<input name="anisotropy" type="float" value="0.0" />
550549
<output name="out" type="vector2" />

libraries/bxdf/gltf_pbr.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
<input name="in" type="vector3" nodename="rotate_tangent" />
354354
</normalize>
355355
<absval name="abs_anisotropy_rotation" type="float">
356-
<input name="in" type="float" interfacename="anisotropy_rotation"/>
356+
<input name="in" type="float" interfacename="anisotropy_rotation" />
357357
</absval>
358358
<ifgreater name="selected_tangent" type="vector3">
359359
<input name="value1" type="float" nodename="abs_anisotropy_rotation" />

libraries/bxdf/lama/lama_iridescence.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<rotate3d name="tangent_rotate" type="vector3">
7373
<input name="in" type="vector3" interfacename="anisotropyDirection" />
7474
<input name="amount" type="float" nodename="tangent_rotate_degree_offset" />
75-
<input name="axis" type="vector3" nodename="tangent_normal" /> />
75+
<input name="axis" type="vector3" nodename="tangent_normal" />
7676
</rotate3d>
7777
<normalize name="tangent_rotate_normalize" type="vector3">
7878
<input name="in" type="vector3" nodename="tangent_rotate" />

libraries/bxdf/open_pbr_surface.mtlx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,21 +301,21 @@
301301
</multiply>
302302

303303
<!-- Dielectric Base -->
304-
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
305-
<divide name="specular_to_coat_ior_ratio" type="float">
306-
<input name="in1" type="float" interfacename="specular_ior" />
307-
<input name="in2" type="float" interfacename="coat_ior" />
308-
</divide>
309-
<divide name="coat_to_specular_ior_ratio" type="float">
310-
<input name="in1" type="float" interfacename="coat_ior" />
311-
<input name="in2" type="float" interfacename="specular_ior" />
312-
</divide>
313-
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
314-
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
315-
<input name="value2" type="float" value="1.0" />
316-
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
317-
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
318-
</ifgreater>
304+
<!-- apply IOR ratio inversion method to avoid TIR artifact (as in Coat TIR section of spec) -->
305+
<divide name="specular_to_coat_ior_ratio" type="float">
306+
<input name="in1" type="float" interfacename="specular_ior" />
307+
<input name="in2" type="float" interfacename="coat_ior" />
308+
</divide>
309+
<divide name="coat_to_specular_ior_ratio" type="float">
310+
<input name="in1" type="float" interfacename="coat_ior" />
311+
<input name="in2" type="float" interfacename="specular_ior" />
312+
</divide>
313+
<ifgreater name="specular_to_coat_ior_ratio_tir_fix" type="float">
314+
<input name="value1" type="float" nodename="specular_to_coat_ior_ratio" />
315+
<input name="value2" type="float" value="1.0" />
316+
<input name="in1" type="float" nodename="specular_to_coat_ior_ratio" />
317+
<input name="in2" type="float" nodename="coat_to_specular_ior_ratio" />
318+
</ifgreater>
319319
<mix name="eta_s" type="float">
320320
<input name="fg" type="float" nodename="specular_to_coat_ior_ratio_tir_fix" />
321321
<input name="bg" type="float" interfacename="specular_ior" />

libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<output name="diffuse_roughness_out" type="float" />
5454
<output name="metalness_out" type="float" />
5555

56-
<output name="specular_out" type="float"/>
56+
<output name="specular_out" type="float" />
5757
<output name="specular_color_out" type="color3" />
5858
<output name="specular_roughness_out" type="float" />
5959
<output name="specular_IOR_out" type="float" />

libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<input name="specular_anisotropy" type="float" value="0" />
1515

1616
<input name="transmission" type="float" value="0" />
17-
<input name="transmission_color" type="color3" value="1, 1, 1"/>
17+
<input name="transmission_color" type="color3" value="1, 1, 1" />
1818
<input name="transmission_depth" type="float" value="0" />
1919
<input name="transmission_scatter" type="color3" value="0, 0, 0" />
2020
<input name="transmission_scatter_anisotropy" type="float" value="0" />
2121
<input name="transmission_dispersion" type="float" value="0" />
22-
22+
2323
<input name="subsurface" type="float" value="0" uimin="0.0" />
2424
<input name="subsurface_color" type="color3" value="1, 1, 1" />
2525
<input name="subsurface_radius" type="color3" value="1, 1, 1" />
@@ -36,7 +36,7 @@
3636
<input name="coat_anisotropy" type="float" value="0.0" />
3737
<input name="coat_IOR" type="float" value="1.5" />
3838
<input name="coat_affect_roughness" type="float" value="0" />
39-
39+
4040
<input name="thin_film_thickness" type="float" value="0" />
4141
<input name="thin_film_IOR" type="float" value="1.5" />
4242

@@ -64,7 +64,7 @@
6464
<output name="transmission_scatter_out" type="color3" />
6565
<output name="transmission_scatter_anisotropy_out" type="float" />
6666
<output name="transmission_dispersion_scale_out" type="float" />
67-
67+
6868
<output name="subsurface_weight_out" type="float" />
6969
<output name="subsurface_color_out" type="color3" />
7070
<output name="subsurface_radius_out" type="float" />
@@ -132,7 +132,7 @@
132132
</dotproduct>
133133
<!--Intentionally ignoring the original specular_color input for metals, since the translation between these concepts will take more thought.-->
134134
<ifequal name="specColor" type="color3">
135-
<input name="value1" type="float" value="0.0" />
135+
<input name="value1" type="float" value="0.0" />
136136
<input name="value2" type="float" nodename="dotProd" />
137137
<input name="in1" type="color3" value="1.0, 1.0, 1.0" />
138138
<input name="in2" type="color3" interfacename="specular_color" />
@@ -271,7 +271,7 @@
271271
<output name="specular_roughness_out" type="float" nodename="specRoughness" />
272272
<output name="specular_ior_out" type="float" nodename="specIOR" />
273273
<output name="specular_roughness_anisotropy_out" type="float" nodename="specRoughnessAnisotropy" />
274-
274+
275275
<output name="transmission_weight_out" type="float" nodename="transmissionWeight" />
276276
<output name="transmission_color_out" type="color3" nodename="transmissionColor" />
277277
<output name="transmission_depth_out" type="float" nodename="transmissionDepth" />

libraries/bxdf/usd_preview_surface.mtlx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@
6464
<nodedef name="ND_UsdPrimvarReader_string" nodegroup="geometric" node="UsdPrimvarReader">
6565
<input name="varname" type="string" value="" uniform="true" />
6666
<input name="fallback" type="string" value="" uniform="true" />
67-
<output name="out" type="string" uniform="true"/>
67+
<output name="out" type="string" uniform="true" />
6868
</nodedef>
6969
<nodedef name="ND_UsdPrimvarReader_filename" nodegroup="geometric" node="UsdPrimvarReader">
7070
<input name="varname" type="string" value="" uniform="true" />
7171
<input name="fallback" type="filename" value="" uniform="true" />
72-
<output name="out" type="filename" uniform="true"/>
72+
<output name="out" type="filename" uniform="true" />
7373
</nodedef>
7474
<nodedef name="ND_UsdPrimvarReader_float" nodegroup="geometric" node="UsdPrimvarReader">
7575
<input name="varname" type="string" value="" uniform="true" />

libraries/cmlib/cmlib_ng.mtlx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@
315315

316316
<nodegraph name="NG_srgb_displayp3_to_lin_rec709_color3" nodedef="ND_srgb_displayp3_to_lin_rec709_color3">
317317
<constant name="mat" type="matrix33">
318-
<input name="value" type="matrix33"
319-
value="1.22493029, -0.04205868, -0.01964128, -0.22492968, 1.04205894, -0.07864794, 0.00000006,-0.00000001, 1.09828925"/>
318+
<input name="value" type="matrix33" value="1.22493029, -0.04205868, -0.01964128, -0.22492968, 1.04205894, -0.07864794, 0.00000006,-0.00000001, 1.09828925" />
320319
</constant>
321320
<!-- Use srgb_texture_to_lin_rec709 to convert from sRGB to Lin before passing to the mat conversion -->
322321
<srgb_texture_to_lin_rec709 name="srgb_transform" type="color3">
@@ -355,8 +354,7 @@
355354

356355
<nodegraph name="NG_lin_displayp3_to_lin_rec709_color3" nodedef="ND_lin_displayp3_to_lin_rec709_color3">
357356
<constant name="mat" type="matrix33">
358-
<input name="value" type="matrix33"
359-
value="1.22493029, -0.04205868, -0.01964128, -0.22492968, 1.04205894, -0.07864794, 0.00000006,-0.00000001, 1.09828925"/>
357+
<input name="value" type="matrix33" value="1.22493029, -0.04205868, -0.01964128, -0.22492968, 1.04205894, -0.07864794, 0.00000006,-0.00000001, 1.09828925" />
360358
</constant>
361359
<convert name="asVec" type="vector3">
362360
<input name="in" type="color3" interfacename="in" />

0 commit comments

Comments
 (0)