Skip to content

Commit f9e2c6e

Browse files
committed
re-synchronize the templates with the libraries folder.
verified data library builds with zero diffs generated docs match everything discussed in AOUSD - modulo one out standing issue with colorcorrect node. includes fix for mistake when adding default to unifiednoise node
1 parent ac2ac3d commit f9e2c6e

File tree

8 files changed

+78
-17
lines changed

8 files changed

+78
-17
lines changed

libraries/stdlib/stdlib_defs.mtlx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@
12221222
<input name="diminish" type="float" uiname="Diminish" uifolder="Fractal" uisoftmin="0.0" uisoftmax="1.0" value="0.5" doc="The rate at which noise amplitude is diminished for each octave of Fractal noise. Default is 0.5." />
12231223
<input name="type" type="integer" uiname="Noise Type" uifolder="Common" uisoftmin="0" uisoftmax="3" value="0" enum="Perlin,Cell,Worley,Fractal" enumvalues="0,1,2,3" doc="Menu to select the type of noise: Perlin, Cell, Worley, or Fractal. Default is Perlin." />
12241224
<input name="style" uiname="Worley Cell Style" type="integer" value="0" enum="Distance,Solid" enumvalues="0,1" doc="Sets the style of cell used when Noise Type is set to Worley." />
1225-
<output name="out" type="float" value="0.0" />
1225+
<output name="out" type="float" default="0.0" />
12261226
</nodedef>
12271227

12281228
<!--
@@ -1242,7 +1242,7 @@
12421242
<input name="diminish" type="float" uiname="Diminish" uifolder="Fractal" uisoftmin="0.0" uisoftmax="1.0" value="0.5" doc="The rate at which noise amplitude is diminished for each octave of Fractal noise. Default is 0.5." />
12431243
<input name="type" type="integer" uiname="Noise Type" uifolder="Common" uisoftmin="0" uisoftmax="3" value="0" enum="Perlin,Cell,Worley,Fractal" enumvalues="0,1,2,3" doc="Menu to select the type of noise: Perlin, Cell, Worley, or Fractal. Default is Perlin." />
12441244
<input name="style" uiname="Worley Cell Style" type="integer" value="0" enum="Distance,Solid" enumvalues="0,1" doc="Sets the style of cell used when Noise Type is set to Worley." />
1245-
<output name="out" type="float" value="0.0" />
1245+
<output name="out" type="float" default="0.0" />
12461246
</nodedef>
12471247

12481248
<!--

source/MaterialXBuildTools/buildDocs/Main.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ mx::StringVec convertOptionToConsolidatedTypes(const mx::StringVec& options)
232232
"string", "filename",
233233
"surfaceshader", "displacementshader", "volumeshader", "lightshader"
234234
};
235+
// TODO - for now we're just looking at stdlib - so we're just gonna skip these types
236+
// this is because the `mix` node actually belongs in two separate documents
237+
// standard nods and PBR nodes
238+
static const std::vector<std::string> skipTypes = {"surfaceshader", "displacementshader", "volumeshader", "lightshader"};
235239

236240
auto contains = [&](const std::vector<std::string>& array, const std::string& str) -> bool {
237241
return std::find(array.begin(), array.end(), str) != array.end();
@@ -278,6 +282,14 @@ mx::StringVec convertOptionToConsolidatedTypes(const mx::StringVec& options)
278282
parts.emplace_back("matrixNN");
279283
}
280284

285+
// remove the skipped types for now.
286+
for (const auto& skipType : skipTypes)
287+
{
288+
if (contains(parts, skipType))
289+
remove(parts, skipType);
290+
}
291+
292+
281293
std::vector<std::string> res;
282294
for (const auto& part : preferredOptionOrder)
283295
{

source/MaterialXFormat/XmlIo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class MX_FORMAT_API XmlReadOptions
5757
/// Defaults to an empty vector.
5858
StringVec parentXIncludes;
5959

60-
/// Expand any <template> tags present in the document
60+
/// Expand any template tags present in the document
6161
bool expandTemplateElems = false;
6262
};
6363

templates/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This is a temporary validation step - so I decided not to promote this setting
33
# to a first class CMake option for now - we may decide we want to do this if
44
# running this in CI is helpful -
5-
set(MATERIALX_COMPARE_TEMPLATES_TO_LIBRARY OFF)
5+
set(MATERIALX_COMPARE_TEMPLATES_TO_LIBRARY ON)
66

77
if(MATERIALX_COMPARE_TEMPLATES_TO_LIBRARY)
88
# Here we run both the "libraries" and "templates" folder through the

templates/bxdf/translation/standard_surface_to_gltf_pbr.mtlx

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<input name="specular_anisotropy" type="float" value="0.0" />
99
<input name="specular_rotation" type="float" value="0.0" />
1010
<input name="specular_roughness" type="float" value="0.2" />
11+
<input name="specular_IOR" type="float" value="1.5" />
1112
<input name="transmission" type="float" value="0" />
1213
<input name="transmission_color" type="color3" value="1, 1, 1" />
1314
<input name="transmission_depth" type="float" value="0" />
@@ -19,10 +20,14 @@
1920
<input name="coat_roughness" type="float" value="0.1" />
2021
<input name="emission" type="float" value="0" />
2122
<input name="emission_color" type="color3" value="1, 1, 1" />
23+
<input name="normal" type="vector3" defaultgeomprop="Nworld" />
24+
<input name="tangent" type="vector3" defaultgeomprop="Tworld" />
25+
<input name="opacity" type="color3" value="1, 1, 1" />
2226

2327
<output name="base_color_out" type="color3" />
2428
<output name="metallic_out" type="float" />
2529
<output name="roughness_out" type="float" />
30+
<output name="ior_out" type="float" />
2631
<output name="anisotropy_strength_out" type="float" />
2732
<output name="anisotropy_rotation_out" type="float" />
2833
<output name="transmission_out" type="float" />
@@ -33,6 +38,11 @@
3338
<output name="clearcoat_out" type="float" />
3439
<output name="clearcoat_roughness_out" type="float" />
3540
<output name="emissive_out" type="color3" />
41+
<output name="emissive_strength_out" type="float" />
42+
<output name="normal_out" type="vector3" />
43+
<output name="tangent_out" type="vector3" />
44+
<output name="alpha_out" type="float" />
45+
<output name="alpha_mode_out" type="integer" />
3646
</nodedef>
3747

3848
<nodegraph name="NG_standard_surface_to_gltf_pbr" nodedef="ND_standard_surface_to_gltf_pbr">
@@ -186,14 +196,47 @@
186196
</dot>
187197

188198
<!-- Emission -->
189-
<multiply name="emissive" type="color3">
190-
<input name="in1" type="color3" interfacename="emission_color" />
191-
<input name="in2" type="float" interfacename="emission" />
192-
</multiply>
199+
<dot name="emissive" type="color3">
200+
<input name="in" type="color3" interfacename="emission_color" />
201+
</dot>
202+
<dot name="emissive_strength" type="float">
203+
<input name="in" type="float" interfacename="emission" />
204+
</dot>
205+
206+
<!-- Specular Index of Refraction -->
207+
<dot name="ior" type="float">
208+
<input name="in" type="float" interfacename="specular_IOR" />
209+
</dot>
210+
211+
<!-- Geometry -->
212+
<dot name="normal" type="vector3">
213+
<input name="in" type="vector3" interfacename="normal" />
214+
</dot>
215+
<dot name="tangent" type="vector3">
216+
<input name="in" type="vector3" interfacename="tangent" />
217+
</dot>
218+
219+
<!-- Opacity -->
220+
<luminance name="opacity_luminance" type="color3">
221+
<input name="in" type="color3" interfacename="opacity" />
222+
</luminance>
223+
224+
<extract name="opacity_luminance_float" type="float">
225+
<input name="in" type="color3" nodename="opacity_luminance" />
226+
<input name="index" type="integer" value="0" />
227+
</extract>
228+
229+
<ifequal name="alpha_mode_from_opacity_luminance" type="integer">
230+
<input name="value1" type="float" nodename="opacity_luminance_float" />
231+
<input name="value2" type="float" value="1.0" />
232+
<input name="in1" type="integer" value="0" />
233+
<input name="in2" type="integer" value="2" />
234+
</ifequal>
193235

194236
<output name="base_color_out" type="color3" nodename="base_color" />
195237
<output name="metallic_out" type="float" nodename="metallic" />
196238
<output name="roughness_out" type="float" nodename="roughness" />
239+
<output name="ior_out" type="float" nodename="ior" />
197240
<output name="anisotropy_strength_out" type="float" nodename="anisotropy_strength" />
198241
<output name="anisotropy_rotation_out" type="float" nodename="anisotropy_rotation" />
199242
<output name="transmission_out" type="float" nodename="transmission" />
@@ -204,6 +247,11 @@
204247
<output name="clearcoat_out" type="float" nodename="clearcoat" />
205248
<output name="clearcoat_roughness_out" type="float" nodename="clearcoat_roughness" />
206249
<output name="emissive_out" type="color3" nodename="emissive" />
250+
<output name="emissive_strength_out" type="float" nodename="emissive_strength" />
251+
<output name="normal_out" type="vector3" nodename="normal" />
252+
<output name="tangent_out" type="vector3" nodename="tangent" />
253+
<output name="alpha_out" type="float" nodename="opacity_luminance_float" />
254+
<output name="alpha_mode_out" type="integer" nodename="alpha_mode_from_opacity_luminance" />
207255

208256
</nodegraph>
209257
</materialx>

templates/stdlib/genglsl/stdlib_genglsl_impl.mtlx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@
249249
<implementation name="IM_multiply_vector3FA_genglsl" nodedef="ND_multiply_vector3FA" target="genglsl" sourcecode="{{in1}} * {{in2}}" />
250250
<implementation name="IM_multiply_vector4_genglsl" nodedef="ND_multiply_vector4" target="genglsl" sourcecode="{{in1}} * {{in2}}" />
251251
<implementation name="IM_multiply_vector4FA_genglsl" nodedef="ND_multiply_vector4FA" target="genglsl" sourcecode="{{in1}} * {{in2}}" />
252-
<implementation name="IM_multiply_matrix33_genglsl" nodedef="ND_multiply_matrix33" target="genglsl" sourcecode="{{in2}} * {{in1}}" />
253-
<implementation name="IM_multiply_matrix44_genglsl" nodedef="ND_multiply_matrix44" target="genglsl" sourcecode="{{in2}} * {{in1}}" />
252+
<implementation name="IM_multiply_matrix33_genglsl" nodedef="ND_multiply_matrix33" target="genglsl" sourcecode="mx_matrix_mul({{in2}}, {{in1}})" />
253+
<implementation name="IM_multiply_matrix44_genglsl" nodedef="ND_multiply_matrix44" target="genglsl" sourcecode="mx_matrix_mul({{in2}}, {{in1}})" />
254254

255255
<!-- <divide> -->
256256
<implementation name="IM_divide_float_genglsl" nodedef="ND_divide_float" target="genglsl" sourcecode="{{in1}} / {{in2}}" />
@@ -264,8 +264,8 @@
264264
<implementation name="IM_divide_vector3FA_genglsl" nodedef="ND_divide_vector3FA" target="genglsl" sourcecode="{{in1}} / {{in2}}" />
265265
<implementation name="IM_divide_vector4_genglsl" nodedef="ND_divide_vector4" target="genglsl" sourcecode="{{in1}} / {{in2}}" />
266266
<implementation name="IM_divide_vector4FA_genglsl" nodedef="ND_divide_vector4FA" target="genglsl" sourcecode="{{in1}} / {{in2}}" />
267-
<implementation name="IM_divide_matrix33_genglsl" nodedef="ND_divide_matrix33" target="genglsl" sourcecode="mx_inverse({{in2}}) * {{in1}}" />
268-
<implementation name="IM_divide_matrix44_genglsl" nodedef="ND_divide_matrix44" target="genglsl" sourcecode="mx_inverse({{in2}}) * {{in1}}" />
267+
<implementation name="IM_divide_matrix33_genglsl" nodedef="ND_divide_matrix33" target="genglsl" sourcecode="mx_matrix_mul(mx_inverse({{in2}}), {{in1}})" />
268+
<implementation name="IM_divide_matrix44_genglsl" nodedef="ND_divide_matrix44" target="genglsl" sourcecode="mx_matrix_mul(mx_inverse({{in2}}), {{in1}})" />
269269

270270
<!-- <modulo> -->
271271
<implementation name="IM_modulo_float_genglsl" nodedef="ND_modulo_float" target="genglsl" sourcecode="mx_mod({{in1}}, {{in2}})" />
@@ -469,9 +469,9 @@
469469

470470
<!-- <transformmatrix> -->
471471
<implementation name="IM_transformmatrix_vector2M3_genglsl" nodedef="ND_transformmatrix_vector2M3" function="mx_transformmatrix_vector2M3" file="mx_transformmatrix_vector2M3.glsl" target="genglsl" />
472-
<implementation name="IM_transformmatrix_vector3_genglsl" nodedef="ND_transformmatrix_vector3" target="genglsl" sourcecode="{{mat}} * {{in}}" />
472+
<implementation name="IM_transformmatrix_vector3_genglsl" nodedef="ND_transformmatrix_vector3" target="genglsl" sourcecode="mx_matrix_mul({{mat}}, {{in}})" />
473473
<implementation name="IM_transformmatrix_vector3M4_genglsl" nodedef="ND_transformmatrix_vector3M4" function="mx_transformmatrix_vector3M4" file="mx_transformmatrix_vector3M4.glsl" target="genglsl" />
474-
<implementation name="IM_transformmatrix_vector4_genglsl" nodedef="ND_transformmatrix_vector4" target="genglsl" sourcecode="{{mat}} * {{in}}" />
474+
<implementation name="IM_transformmatrix_vector4_genglsl" nodedef="ND_transformmatrix_vector4" target="genglsl" sourcecode="mx_matrix_mul({{mat}}, {{in}})" />
475475

476476
<!-- <transpose> -->
477477
<implementation name="IM_transpose_matrix33_genglsl" nodedef="ND_transpose_matrix33" target="genglsl" sourcecode="transpose({{in}})" />

templates/stdlib/genosl/stdlib_genosl_impl.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174

175175
<!-- <geompropvalueuniform> -->
176176
<implementation name="IM_geompropvalue_string_genosl" nodedef="ND_geompropvalueuniform_string" file="mx_geompropvalue_string.osl" function="mx_geompropvalue_string" target="genosl" />
177-
<implementation name="IM_geompropvalue_filename_genosl" nodedef="ND_geompropvalueuniform_filename" file="mx_geompropvalue_string.osl" function="mx_geompropvalue_string" target="genosl" />
177+
<implementation name="IM_geompropvalue_filename_genosl" nodedef="ND_geompropvalueuniform_filename" file="mx_geompropvalue_filename.osl" function="mx_geompropvalue_filename" target="genosl" />
178178

179179
<!-- ======================================================================== -->
180180
<!-- Application nodes -->

templates/stdlib/stdlib_defs.mtlx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@
651651
<input name="diminish" type="float" uiname="Diminish" uifolder="Fractal" uisoftmin="0.0" uisoftmax="1.0" value="0.5" doc="The rate at which noise amplitude is diminished for each octave of Fractal noise. Default is 0.5." spec_desc="The rate at which noise amplitude is diminished for each octave"/>
652652
<input name="type" type="integer" uiname="Noise Type" uifolder="Common" uisoftmin="0" uisoftmax="3" value="0" enum="Perlin,Cell,Worley,Fractal" enumvalues="0,1,2,3" doc="Menu to select the type of noise: Perlin, Cell, Worley, or Fractal. Default is Perlin." spec_desc="The type of noise function to use. One of 0 (Perlin), 1 (Cell), 2 (Worley), or 3 (Fractal)"/>
653653
<input name="style" uiname="Worley Cell Style" type="integer" value="0" enum="Distance,Solid" enumvalues="0,1" doc="Sets the style of cell used when Noise Type is set to Worley." spec_desc="The output style "/>
654-
<output name="out" type="float" spec_desc="the computed noise value"/>
654+
<output name="out" type="float" default="0.0" spec_desc="the computed noise value"/>
655655
</nodedef>
656656

657657
<!--
@@ -671,7 +671,7 @@
671671
<input name="diminish" type="float" uiname="Diminish" uifolder="Fractal" uisoftmin="0.0" uisoftmax="1.0" value="0.5" doc="The rate at which noise amplitude is diminished for each octave of Fractal noise. Default is 0.5." spec_desc="The rate at which noise amplitude is diminished for each octave"/>
672672
<input name="type" type="integer" uiname="Noise Type" uifolder="Common" uisoftmin="0" uisoftmax="3" value="0" enum="Perlin,Cell,Worley,Fractal" enumvalues="0,1,2,3" doc="Menu to select the type of noise: Perlin, Cell, Worley, or Fractal. Default is Perlin." spec_desc="The type of noise function to use. One of 0 (Perlin), 1 (Cell), 2 (Worley), or 3 (Fractal)"/>
673673
<input name="style" uiname="Worley Cell Style" type="integer" value="0" enum="Distance,Solid" enumvalues="0,1" doc="Sets the style of cell used when Noise Type is set to Worley." spec_desc="The output style "/>
674-
<output name="out" type="float" spec_desc="the computed noise value"/>
674+
<output name="out" type="float" default="0.0" spec_desc="the computed noise value"/>
675675
</nodedef>
676676

677677
<!--
@@ -1732,6 +1732,7 @@
17321732
<input name="exposure" type="float" uiname="Exposure" uisoftmin="-1.0" uisoftmax="1.0" value="0" doc="Multiplier which increases or decreases color brightness by 2^value." spec_desc="Logarithmic brightness multiplier as 2^`exposure`" />
17331733
<output name="out" type="color4" spec_desc="the color-corrected value" />
17341734
</nodedef>
1735+
17351736
<!-- ======================================================================== -->
17361737
<!-- Compositing nodes -->
17371738
<!-- ======================================================================== -->

0 commit comments

Comments
 (0)