Skip to content

Commit

Permalink
Layering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-lucasfilm committed Jan 31, 2025
1 parent 95fc7c5 commit 6f8d616
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
20 changes: 3 additions & 17 deletions javascript/MaterialXTest/codeExamples.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,15 @@ describe('Code Examples', () =>

// Traverse the document tree in depth-first order.
const elements = doc.traverseTree();
let elementCount = 0;
let nodeCount = 0;
let fileCount = 0;
let imageCount = 0;
for (let elem of elements)
{
elementCount++;
// Display the filename of each image node.
if (elem.isANode('image'))
{
nodeCount++;
const input = elem.getInput('file');
if (input)
{
fileCount++;
const filename = input.getValueString();
expect(elem.getName()).to.equal('image1');
expect(filename).to.equal('greysphere_calibration.png');
}
imageCount++;
}
}
expect(elementCount).to.equal(21);
expect(nodeCount).to.equal(1);
expect(fileCount).to.equal(1);
expect(imageCount).to.greaterThan(0);
});

it('Building a MaterialX Document', async () =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?xml version="1.0"?>
<materialx version="1.39" colorspace="lin_rec709">
<standard_surface name="SR_greysphere" type="surfaceshader">
<input name="base" type="float" value="1.0" />
<input name="base_color" type="color3" value="0.18, 0.18, 0.18" />
<input name="diffuse_roughness" type="float" value="0" />
<input name="specular_roughness" type="float" value="0.7" />
<input name="specular_IOR" type="float" value="1.5" />
</standard_surface>
<surfacematerial name="Greysphere" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_greysphere" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
<output name="out1" type="color3" nodename="image1" />
</nodegraph>
<standard_surface name="SR_Greysphere_Calibration" type="surfaceshader">
<input name="base" type="float" value="1.0" />
<input name="base_color" type="color3" nodegraph="NG_Greysphere_Calibration" output="out1" />
<input name="diffuse_roughness" type="float" value="0" />
<input name="specular_roughness" type="float" value="0.7" />
<input name="specular_IOR" type="float" value="1.5" />
</standard_surface>
<surfacematerial name="Greysphere_Calibration" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_Greysphere_Calibration" />
Expand Down
2 changes: 1 addition & 1 deletion resources/Materials/TestSuite/_options.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
allowing for visual comparisons and differencing across shading languages,
but requiring a more powerful GPU and longer CPU render times.
-->
<input name="enableReferenceQuality" type="boolean" value="false" />
<input name="enableReferenceQuality" type="boolean" value="true" />
</nodedef>
</materialx>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<materialx version="1.39">

<oren_nayar_diffuse_bsdf name="diffuse_bsdf" type="BSDF">
<input name="color" type="color3" value="0.18, 0.18, 0.18" />
</oren_nayar_diffuse_bsdf>
<dielectric_bsdf name="specular_bsdf" type="BSDF">
<input name="roughness" type="vector2" value="1.0, 1.0" />
</dielectric_bsdf>
<layer name="specular_layer" type="BSDF">
<input name="top" type="BSDF" nodename="specular_bsdf" />
<input name="base" type="BSDF" nodename="diffuse_bsdf" />
</layer>

<surface name="diffuse_surf" type="surfaceshader">
<input name="bsdf" type="BSDF" nodename="diffuse_bsdf" />
</surface>
<surface name="specular_surf" type="surfaceshader">
<input name="bsdf" type="BSDF" nodename="specular_bsdf" />
</surface>
<surface name="layer_surf" type="surfaceshader">
<input name="bsdf" type="BSDF" nodename="specular_layer" />
</surface>

<surfacematerial name="diffuse_mat" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="diffuse_surf" />
</surfacematerial>
<surfacematerial name="specular_mat" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="specular_surf" />
</surfacematerial>
<surfacematerial name="layer_mat" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="layer_surf" />
</surfacematerial>

</materialx>

0 comments on commit 6f8d616

Please sign in to comment.