Skip to content

Commit

Permalink
Merge branch 'AcademySoftwareFoundation:main' into create-material-fr…
Browse files Browse the repository at this point in the history
…om-textures
  • Loading branch information
Michaelredaa authored Mar 24, 2024
2 parents e4e1fc7 + 5f9fee7 commit 62821fb
Show file tree
Hide file tree
Showing 23 changed files with 238 additions and 713 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ jobs:
cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON
dynamic_analysis: ON

- name: MacOS_Xcode_11_Python37
os: macos-11
- name: MacOS_Xcode_13_Python37
os: macos-12
compiler: xcode
compiler_version: "11.7"
compiler_version: "13.1"
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON
python: 3.7

Expand All @@ -85,14 +85,14 @@ jobs:
python: 3.11

- name: MacOS_Xcode_15_Python312
os: macos-13
os: macos-14
compiler: xcode
compiler_version: "15.0"
python: 3.12
test_shaders: ON

- name: iOS_Xcode_15
os: macos-13
os: macos-14
compiler: xcode
compiler_version: "15.0"
python: None
Expand Down
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Change Log

## [1.38.9] - Development
## [1.38.9] - 2024-02-26

### Added

- Added an initial NPR (non-photorealistic rendering) data library to MaterialX, supporting the [View Direction](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1631), [Facing Ratio](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1671), and [Gooch Shading](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1674) nodes.
- Added new nodes to the standard data library, including [Reflect](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1690), [Refract](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1698), [Safe Power](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1689) and [Create Matrix](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1553).
- Added new nodes to the standard data library, including [Reflect](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1690), [Refract](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1698), [Safe Power](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1689), [Create Matrix](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1553), and [Round](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1678).
- Added support for the generation of [pre-filtered environment maps](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1420) in MaterialX GLSL and MSL.
- Added support for [geometry drag & drop](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1663), [frame capture](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1636), [UI ranges](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1623) and [enumerated values](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1632) in the MaterialX Web Viewer.
- Added [floating popups](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1565) for hovered pins in the MaterialX Graph Editor.
Expand All @@ -16,19 +16,20 @@

### Changed

- Enabled the [new OSL closures](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1702) by default in shader generation, with the MATERIALX_OSL_LEGACY_CLOSURES flag used to request legacy closures.
- Updated the MaterialX Web Viewer to [three.js r152](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1615).
- Switched to a more efficient representation of [HDR images](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1616) in the MaterialX Web Viewer.
- Improved the logic for [connecting pins](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1569) in the MaterialX Graph Editor.
- Improved the robustness of [type pointer comparisons](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1665) in shader generation.
- Improved the handling of [filename inputs](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1547) in OSL shader generation.
- Reduced the size of the MaterialX data libraries, improving the use of [graph definitions](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1653) and merging [duplicate implementations](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1642).
- Updated the MaterialX Web Viewer to [three.js r152](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1615).
- Switched to a more efficient representation of [HDR images](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1616) in the MaterialX Web Viewer.
- Raised the minimum CMake version to [CMake 3.16](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1607).
- Updated the C++ unit test library to [Catch 2.13.10](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1566).

### Fixed

- Fixed the attenuation of [coated emission](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1534) in the Standard Surface shading model.
- Fixed the implementation of the [overlay node](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1539) in shader generation.
- Fixed an edge case for [type pointer comparisons](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1665) in shader generation.
- Fixed an edge case for [transform nodes](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1560) in GLSL and MSL shader generation.
- Fixed the implementation of [mx_hsvtorgb](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1584) in MDL shader generation.
- Fixed [orphaned links](https://github.com/AcademySoftwareFoundation/MaterialX/pull/1667) when deleting nodes in the MaterialX Graph Editor.
Expand Down
49 changes: 0 additions & 49 deletions resources/Materials/TestSuite/_options.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@
can also be performed depending on the options enabled.
-->

<!-- nodedefs for custom test settings -->
<nodedef name="ND_BakingSettings" node="baker">
<input name="file" type="filename" />
<input name="uvmin" type="vector2" />
<input name="uvmax" type="vector2" />
<input name="hdr" type="boolean" value="false" />
<input name="resolution" type="integer" value="1024" />
</nodedef>

<nodedef name="ND_WedgeRenderSettings" node="wedgerender">
<input name="file" type="filename" />
<input name="parameter" type="string" />
<input name="range" type="vector2" value="0.0, 1.0" />
<input name="steps" type="integer" value="1.0" />
</nodedef>


<!-- Render test Suite Options -->
<nodedef name="TestSuiteOptions">
<!-- List of comma separated file names acts as a filter to only test documents with these names -->
Expand Down Expand Up @@ -95,37 +78,5 @@

<!-- Enable reference quality rendering. Default is false. -->
<input name="enableReferenceQuality" type="boolean" value="false" />

<!-- Wedge rendering options -->
<wedgerender name="wedge_conductor">
<input name="file" type="filename" value="wedge_conductor.mtlx" />
<input name="parameter" type="string" value="test_conductor/roughness1/roughness" />
<input name="range" type="vector2" value="0.0, 1.0" />
<input name="steps" type="integer" value="4" />
</wedgerender>

<wedgerender name="wedge_conductor_2">
<input name="file" type="filename" value="wedge_conductor.mtlx" />
<input name="parameter" type="string" value="test_conductor/roughness1/anisotropy" />
<input name="range" type="vector2" value="0.3, 0.9" />
<input name="steps" type="integer" value="3" />
</wedgerender>

<!-- Bake rendering options: Currently only supports the genglsl_glsl400 shader generator -->
<baker name="mapped_surfaceshader">
<input name="file" type="filename" value="mapped_surfaceshader.mtlx" />
<input name="uvmin" type="vector2" value="0,0" />
<input name="uvmax" type="vector2" value="1,1" />
<input name="hdr" type="boolean" value="false" />
<input name="resolution" type="integer" value="1024" />
</baker>

<baker name="normalmapped_surfaceshader">
<input name="file" type="filename" value="normalmapped_surfaceshader.mtlx" />
<input name="uvmin" type="vector2" value="0,0" />
<input name="uvmax" type="vector2" value="1,1" />
<input name="hdr" type="boolean" value="false" />
<input name="resolution" type="integer" value="1024" />
</baker>
</nodedef>
</materialx>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<materialx version="1.38">
<nodegraph name="generalized_schlick_bsdf">
<nodegraph name="schlick_bsdf">
<generalized_schlick_bsdf name="schlick_R" type="BSDF">
<input name="weight" type="float" value="1.0" />
<input name="color0" type="color3" value="0.7, 0.7, 0.7" />
Expand Down
25 changes: 0 additions & 25 deletions resources/Materials/TestSuite/pbrlib/bsdf/wedge_conductor.mtlx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<materialx version="1.38">
<nodegraph name="displacement_fractal3d_float" type="displacementshader">
<nodegraph name="fractal3d_float" type="displacementshader">
<position name="position1" type="vector3">
<input name="space" type="string" value="object" />
</position>
Expand All @@ -21,7 +21,7 @@
</displacement>
<output name="out" type="displacementshader" nodename="disp1" />
</nodegraph>
<nodegraph name="displacement_fractal3d_vector3" type="displacementshader">
<nodegraph name="fractal3d_vector3" type="displacementshader">
<position name="position1" type="vector3">
<input name="space" type="string" value="object" />
</position>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<materialx version="1.38" xmlns:xi="http://www.w3.org/2001/XInclude">
<nodegraph name="NG_multi_shader_output" nodedef="ND_multi_shader_output">
<nodegraph name="NG_multi" nodedef="ND_multi">
<burley_diffuse_bsdf name="burley_bsdf" type="BSDF">
<input name="color" type="color3" interfacename="diffuse_color" />
</burley_diffuse_bsdf>
Expand All @@ -16,7 +16,7 @@
<output name="burley_out" type="surfaceshader" nodename="burley_surface" />
<output name="dielectric_out" type="surfaceshader" nodename="dielectric_surface" />
</nodegraph>
<nodedef name="ND_multi_shader_output" node="customtype" version="1.0" isdefaultversion="true">
<nodedef name="ND_multi" node="customtype" version="1.0" isdefaultversion="true">
<input name="diffuse_color" type="color3" value="0.25, 0.50, 0.75" />
<output name="burley_out" type="surfaceshader" />
<output name="dielectric_out" type="surfaceshader" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<materialx version="1.38">
<nodedef name="ND_network_surface" node="network_surface">
<input name="base_color_filename" type="filename" value="" />
<output name="out" type="surfaceshader" />
</nodedef>
<nodegraph name="NG_network_surface" nodedef="ND_network_surface">
<tiledimage name="base_color_image" type="color3">
<input name="file" type="filename" interfacename="base_color_filename" />
</tiledimage>
<standard_surface name="standard_surface" type="surfaceshader">
<input name="base_color" type="color3" nodename="base_color_image" />
</standard_surface>
<output name="out" type="surfaceshader" nodename="standard_surface" />
</nodegraph>
<network_surface name="N_surfaceshader" type="surfaceshader">
<input name="base_color_filename" type="filename" value="resources/Images/grid.png" colorspace="srgb_texture" />
</network_surface>
<surfacematerial name="N_surfacematerial" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="N_surfaceshader" />
</surfacematerial>
</materialx>
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
<?xml version="1.0"?>
<materialx version="1.38">
<surfacematerial name="SurfaceMaterial_All_Mapped_NodeGraph_Mapped" type="material">
<input name="surfaceshader" type="surfaceshader" nodegraph="Surf_Displace_NodeGraph" output="out" />
<input name="displacementshader" type="displacementshader" nodegraph="Surf_Displace_NodeGraph" output="displacementshader" />
</surfacematerial>
<nodegraph name="Surf_Displace_NodeGraph">
<nodegraph name="NG_Blue">
<standard_surface name="standard_surface" type="surfaceshader">
<input name="base_color" type="color3" value="0.3, 0.3, 1" />
</standard_surface>
<displacement name="displacement" type="displacementshader" />
<output name="out" type="surfaceshader" nodename="standard_surface" />
<output name="displacementshader" type="displacementshader" nodename="displacement" />
</nodegraph>
<surfacematerial name="SurfaceMaterial_PinkNodeGraph" type="material">
<input name="surfaceshader" type="surfaceshader" nodegraph="Pink_surface_shader_in_graph" />
<input name="displacementshader" type="displacementshader" value="" />
<surfacematerial name="M_Blue" type="material">
<input name="surfaceshader" type="surfaceshader" nodegraph="NG_Blue" output="out" />
<input name="displacementshader" type="displacementshader" nodegraph="NG_Blue" output="displacementshader" />
</surfacematerial>
<nodegraph name="Pink_surface_shader_in_graph">

<nodegraph name="NG_Magenta">
<standard_surface name="standard_surface1" type="surfaceshader">
<input name="base_color" type="color3" value="1, 0, 1" />
</standard_surface>
<output name="out" type="surfaceshader" nodename="standard_surface1" />
</nodegraph>
<nodegraph name="White_SurfaceMaterial_In_NodeGraph">
<surfacematerial name="White_SurfaceMaterial" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="White_Shader" />
<input name="displacementshader" type="displacementshader" value="" />
</surfacematerial>
<standard_surface name="White_Shader" type="surfaceshader" />
<surfacematerial name="M_Magenta" type="material">
<input name="surfaceshader" type="surfaceshader" nodegraph="NG_Magenta" />
</surfacematerial>

<standard_surface name="SR_Orange" type="surfaceshader">
<input name="base_color" type="color3" value="1, 0.3, 0" />
</standard_surface>
<surfacematerial name="M_Orange" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_Orange" />
</surfacematerial>

<nodegraph name="NG_White">
<ramp4 name="ramp4" type="color3">
<input name="valuetl" type="color3" value="0, 0, 1" />
<input name="valuetr" type="color3" value="1, 0, 0" />
<input name="valuebl" type="color3" value="0, 1, 0" />
<input name="valuebr" type="color3" value="0, 1, 1" />
</ramp4>
<output name="out" type="material" nodename="White_SurfaceMaterial" />
<standard_surface name="SR_White" type="surfaceshader" />
<surfacematerial name="M_White" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_White" />
</surfacematerial>
<output name="out" type="material" nodename="M_White" />
</nodegraph>
<surfacematerial name="Orange_Top_Level_SurfaceMaterial" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="Orange_Top_level_surface_shader" />
<input name="displacementshader" type="displacementshader" value="" />
</surfacematerial>
<standard_surface name="Orange_Top_level_surface_shader" type="surfaceshader">
<input name="base_color" type="color3" value="1, 0.3, 0" />
</standard_surface>
<surfacematerial name="Fail_surfacematerial_No_Shader" type="material">

<surfacematerial name="M_EmptySurface" type="material">
<input name="surfaceshader" type="surfaceshader" value="" />
<input name="displacementshader" type="displacementshader" value="" />
</surfacematerial>
<volumematerial name="Fail_volumematerial_unsupported" type="material">
<volumematerial name="M_EmptyVolume" type="material">
<input name="volumeshader" type="volumeshader" value="" />
</volumematerial>
</materialx>
6 changes: 6 additions & 0 deletions source/MaterialXCore/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,12 @@ class MX_CORE_API TypedElement : public Element
return getAttribute(TYPE_ATTRIBUTE);
}

/// Return true if the element is of color type.
bool isColorType() const
{
return getType() == "color3" || getType() == "color4";
}

/// Return true if the element is of multi-output type.
bool isMultiOutputType() const
{
Expand Down
19 changes: 19 additions & 0 deletions source/MaterialXGenShader/GenContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,24 @@ class MX_GENSHADER_API GenContext
return _closureContexts.size() ? _closureContexts.back() : nullptr;
}

/// Push a parent node onto the stack
void pushParentNode(ConstNodePtr node)
{
_parentNodes.push_back(node);
}

/// Pop the current parent node from the stack.
void popParentNode()
{
_parentNodes.pop_back();
}

/// Return the current stack of parent nodes.
const vector<ConstNodePtr>& getParentNodes()
{
return _parentNodes;
}

/// Add user data to the context to make it
/// available during shader generator.
void pushUserData(const string& name, GenUserDataPtr data)
Expand Down Expand Up @@ -216,6 +234,7 @@ class MX_GENSHADER_API GenContext
std::unordered_map<const ShaderOutput*, string> _outputSuffix;

vector<ClosureContext*> _closureContexts;
vector<ConstNodePtr> _parentNodes;

ApplicationVariableHandler _applicationVariableHandler;
};
Expand Down
Loading

0 comments on commit 62821fb

Please sign in to comment.