Skip to content

Commit

Permalink
Simplify greysphere example materials (#2207)
Browse files Browse the repository at this point in the history
- Remove default-valued inputs from the Standard Surface Greysphere example materials, leaving only those inputs that have a visual impact.
- Decouple a JavaScript unit test from the specific element counts of example materials.
  • Loading branch information
jstone-lucasfilm authored Jan 31, 2025
1 parent 95fc7c5 commit 4582901
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 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

0 comments on commit 4582901

Please sign in to comment.