Skip to content

Commit 14b73c4

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into editor_capture
2 parents 3fc6e10 + 1ef82c8 commit 14b73c4

20 files changed

Lines changed: 277 additions & 121 deletions

File tree

.github/workflows/main.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,33 @@ jobs:
6767
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON
6868
python: 3.11
6969

70-
- name: MacOS_Xcode_16_Python312
70+
- name: MacOS_Xcode_16_Python313
7171
os: macos-15
7272
compiler: xcode
73-
compiler_version: "16.1"
74-
python: 3.12
73+
compiler_version: "16.4"
74+
python: 3.13
7575
test_shaders: ON
7676

77-
- name: MacOS_Xcode_16_Python313
78-
os: macos-15
77+
- name: MacOS_Xcode_26_Python313
78+
os: macos-26
7979
compiler: xcode
80-
compiler_version: "16.1"
80+
compiler_version: "26.0"
8181
python: 3.13
8282
static_analysis: ON
8383
cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
8484

8585
- name: MacOS_Xcode_DynamicAnalysis
86-
os: macos-15
86+
os: macos-26
8787
compiler: xcode
88-
compiler_version: "16.1"
88+
compiler_version: "26.0"
8989
python: None
9090
dynamic_analysis: ON
9191
cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON
9292

93-
- name: iOS_Xcode_16
94-
os: macos-15
93+
- name: iOS_Xcode_26
94+
os: macos-26
9595
compiler: xcode
96-
compiler_version: "16.1"
96+
compiler_version: "26.0"
9797
python: None
9898
cmake_config: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` -DCMAKE_OSX_ARCHITECTURES=arm64
9999

@@ -144,15 +144,9 @@ jobs:
144144
if: runner.os == 'macOS'
145145
run: |
146146
if [ "${{ matrix.compiler_version }}" != 'None' ]; then
147-
if [ "${{ matrix.compiler }}" = "gcc" ]; then
148-
brew install gcc@${{ matrix.compiler_version }}
149-
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
150-
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
151-
else
152-
ls -ls /Applications/
153-
sudo xcode-select -switch /Applications/Xcode_${{ matrix.compiler_version }}.app
154-
echo "CC=clang" >> $GITHUB_ENV
155-
echo "CXX=clang++" >> $GITHUB_ENV
147+
sudo xcode-select -switch /Applications/Xcode_${{ matrix.compiler_version }}.app
148+
if [ "${{ matrix.os }}" == 'macos-26' ]; then
149+
xcodebuild -downloadComponent MetalToolchain
156150
fi
157151
fi
158152

documents/Specification/MaterialX.PBRSpec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ Note that the standard library includes definitions for [**`displacement`**](./M
388388
* **`artistic_ior`**: Converts the artistic parameterization reflectivity and edge_color to complex IOR values. To be used with the [<conductor_bsdf>](#node-conductor-bsdf) node.
389389
* `reflectivity` (color3): Reflectivity per color component at facing angles. Defaults to (0.947, 0.776, 0.371).
390390
* `edge_color` (color3): Reflectivity per color component at grazing angles. Defaults to (1.0, 0.982, 0.753).
391-
* `ior` (**output**, vector3): Computed index of refraction.
392-
* `extinction` (**output**, vector3): Computed extinction coefficient.
391+
* `ior` (**output**, color3): Computed index of refraction.
392+
* `extinction` (**output**, color3): Computed extinction coefficient.
393393

394394
<a id="node-chiang-hair-roughness"> </a>
395395

libraries/bxdf/translation/standard_surface_to_gltf_pbr.mtlx

Lines changed: 30 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,13 @@
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" />
2225

2326
<output name="base_color_out" type="color3" />
2427
<output name="metallic_out" type="float" />
2528
<output name="roughness_out" type="float" />
29+
<output name="ior_out" type="float" />
2630
<output name="anisotropy_strength_out" type="float" />
2731
<output name="anisotropy_rotation_out" type="float" />
2832
<output name="transmission_out" type="float" />
@@ -33,6 +37,9 @@
3337
<output name="clearcoat_out" type="float" />
3438
<output name="clearcoat_roughness_out" type="float" />
3539
<output name="emissive_out" type="color3" />
40+
<output name="emissive_strength_out" type="float" />
41+
<output name="normal_out" type="vector3" />
42+
<output name="tangent_out" type="vector3" />
3643
</nodedef>
3744

3845
<nodegraph name="NG_standard_surface_to_gltf_pbr" nodedef="ND_standard_surface_to_gltf_pbr">
@@ -186,14 +193,30 @@
186193
</dot>
187194

188195
<!-- 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>
196+
<dot name="emissive" type="color3">
197+
<input name="in" type="color3" interfacename="emission_color" />
198+
</dot>
199+
<dot name="emissive_strength" type="float">
200+
<input name="in" type="float" interfacename="emission" />
201+
</dot>
202+
203+
<!-- Specular Index of Refraction -->
204+
<dot name="ior" type="float">
205+
<input name="in" type="float" interfacename="specular_IOR" />
206+
</dot>
207+
208+
<!-- Geometry -->
209+
<dot name="normal" type="vector3">
210+
<input name="in" type="vector3" interfacename="normal" />
211+
</dot>
212+
<dot name="tangent" type="vector3">
213+
<input name="in" type="vector3" interfacename="tangent" />
214+
</dot>
193215

194216
<output name="base_color_out" type="color3" nodename="base_color" />
195217
<output name="metallic_out" type="float" nodename="metallic" />
196218
<output name="roughness_out" type="float" nodename="roughness" />
219+
<output name="ior_out" type="float" nodename="ior" />
197220
<output name="anisotropy_strength_out" type="float" nodename="anisotropy_strength" />
198221
<output name="anisotropy_rotation_out" type="float" nodename="anisotropy_rotation" />
199222
<output name="transmission_out" type="float" nodename="transmission" />
@@ -204,6 +227,9 @@
204227
<output name="clearcoat_out" type="float" nodename="clearcoat" />
205228
<output name="clearcoat_roughness_out" type="float" nodename="clearcoat_roughness" />
206229
<output name="emissive_out" type="color3" nodename="emissive" />
230+
<output name="emissive_strength_out" type="float" nodename="emissive_strength" />
231+
<output name="normal_out" type="vector3" nodename="normal" />
232+
<output name="tangent_out" type="vector3" nodename="tangent" />
207233

208234
</nodegraph>
209235
</materialx>

libraries/pbrlib/genglsl/lib/mx_microfacet_specular.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ vec3 mx_fresnel_airy(float cosTheta, FresnelData fd)
374374

375375
// Reflectance term for m>0 (pairs of diracs)
376376
Cm = Rs - T121.x;
377-
for (int m=1; m<=2; m++)
377+
for (int m = 1; m <= AIRY_FRESNEL_ITERATIONS; m++)
378378
{
379379
Cm *= r123p;
380380
Sm = 2.0 * mx_eval_sensitivity(float(m) * opd, float(m)*(phi23p+vec3(phi21.x)));
@@ -389,7 +389,7 @@ vec3 mx_fresnel_airy(float cosTheta, FresnelData fd)
389389

390390
// Reflectance term for m>0 (pairs of diracs)
391391
Cm = Rp - T121.y;
392-
for (int m=1; m<=2; m++)
392+
for (int m = 1; m <= AIRY_FRESNEL_ITERATIONS; m++)
393393
{
394394
Cm *= r123s;
395395
Sm = 2.0 * mx_eval_sensitivity(float(m) * opd, float(m)*(phi23s+vec3(phi21.y)));
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
void mx_geompropvalue_filename(string geomprop, textureresource defaultVal, output textureresource out)
2+
{
3+
// Initialize to the default
4+
out = defaultVal;
5+
6+
// Replace the filename component from the geomprop
7+
string defaultFilename = defaultVal.filename;
8+
if (getattribute(geomprop, defaultFilename) == 0)
9+
out.filename = defaultFilename;
10+
}

libraries/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 -->

source/MaterialXGenGlsl/GlslShaderGenerator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ void GlslShaderGenerator::emitPixelStage(const ShaderGraph& graph, GenContext& c
404404
emitLineBreak(stage);
405405
}
406406

407+
// Define Airy Fresnel iterations
408+
emitLine("#define AIRY_FRESNEL_ITERATIONS " + std::to_string(context.getOptions().hwAiryFresnelIterations), stage, false);
409+
emitLineBreak(stage);
410+
407411
// Add lighting support
408412
if (lighting)
409413
{

source/MaterialXGenMdl/MdlShaderGenerator.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,19 @@ void emitInputAnnotations(const MdlShaderGenerator& _this, const ShaderPort* var
698698

699699
_this.emitLineEnd(stage, false);
700700
_this.emitLine("[[", stage, false);
701-
_this.emitLine("\t" + mtlxParameterPathAnno, stage, false);
701+
_this.emitLineBegin(stage);
702+
_this.emitString(_this.getSyntax().getIndentation() + mtlxParameterPathAnno, stage);
703+
const ShaderGraphInputSocket* input = static_cast<const ShaderGraphInputSocket*>(variable);
704+
705+
if (input->getConnections().empty())
706+
{
707+
_this.emitString(",", stage);
708+
_this.emitLineEnd(stage, false);
709+
_this.emitLineBegin(stage);
710+
_this.emitString(_this.getSyntax().getIndentation() + "anno::unused()", stage);
711+
}
712+
713+
_this.emitLineEnd(stage, false);
702714
_this.emitLineBegin(stage);
703715
_this.emitString("]]", stage); // line ending follows by caller
704716
}

source/MaterialXGenMdl/Nodes/CompoundNodeMdl.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,22 @@ void CompoundNodeMdl::emitFunctionSignature(const ShaderNode&, GenContext& conte
254254
}
255255

256256
const string& delim = --count > 0 ? Syntax::COMMA : EMPTY_STRING;
257-
shadergen.emitLine(qualifier + type + " " + input->getVariable() + " = " + value + delim, stage, false);
257+
shadergen.emitLineBegin(stage);
258+
shadergen.emitString(qualifier + type + " " + input->getVariable() + " = " + value, stage);
259+
260+
if (input->getConnections().empty())
261+
{
262+
shadergen.emitLineEnd(stage, false);
263+
shadergen.emitLine("[[", stage, false);
264+
shadergen.emitLineBegin(stage);
265+
shadergen.emitString(syntax.getIndentation() + "anno::unused()", stage);
266+
shadergen.emitLineEnd(stage, false);
267+
shadergen.emitLineBegin(stage);
268+
shadergen.emitString("]]", stage);
269+
}
270+
271+
shadergen.emitString(delim, stage);
272+
shadergen.emitLineEnd(stage, false);
258273
}
259274

260275
// End function signature.

source/MaterialXGenMsl/MslShaderGenerator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,10 @@ void MslShaderGenerator::emitPixelStage(const ShaderGraph& graph, GenContext& co
874874
emitLineBreak(stage);
875875
}
876876

877+
// Define Airy Fresnel iterations
878+
emitLine("#define AIRY_FRESNEL_ITERATIONS " + std::to_string(context.getOptions().hwAiryFresnelIterations), stage, false);
879+
emitLineBreak(stage);
880+
877881
// Add lighting support
878882
if (lighting)
879883
{

0 commit comments

Comments
 (0)