Skip to content

Commit a5fd7be

Browse files
authored
Merge branch 'AcademySoftwareFoundation:main' into graph_editor_bg_colour
2 parents 03a5412 + d01bfb3 commit a5fd7be

33 files changed

Lines changed: 548 additions & 317 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The following packages contain pre-built binaries for the latest release, includ
7979

8080
## Additional Resources
8181

82-
- The [Developer Guide](http://www.materialx.org/docs/api/index.html) contains a developer-oriented overview of MaterialX with API documentation.
82+
- The [Developer Guide](http://www.materialx.org/docs/api/index.html) contains a developer-oriented overview of MaterialX with Build and API documentation.
8383
- The [Python Scripts](python/Scripts) folder contains standalone examples of MaterialX Python code.
8484
- The [JavaScript](javascript) folder contains details on building JavaScript bindings for MaterialX.
8585
- Presentations at [ASWF Open Source Days](https://materialx.org/assets/ASWF_OSD2024_MaterialX_Final.pdf) and the [SIGGRAPH Physically Based Shading Course](https://blog.selfshadow.com/publications/s2020-shading-course/#materialx) provide details on the roadmap for MaterialX development.

documents/DeveloperGuide/MainPage.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ The MaterialX codebase requires a compiler with support for C++17, and can be bu
2020

2121
The Python bindings for MaterialX are based on [PyBind11](https://github.com/pybind/pybind11), and support Python versions 3.9 and greater.
2222

23+
On macOS, you'll need to [install Xcode](https://developer.apple.com/xcode/resources/), in order to get access to the Metal Tools as well as compiler toolchains.
24+
2325
## Building MaterialX
2426

2527
### Building MaterialX C++
@@ -52,6 +54,29 @@ Select the `MATERIALX_BUILD_VIEWER` option to build the MaterialX Viewer. Insta
5254

5355
To generate HTML documentation for the MaterialX C++ API, make sure a version of [Doxygen](https://www.doxygen.org/) is on your path, and select the advanced option `MATERIALX_BUILD_DOCS` in CMake. This option will add a target named `MaterialXDocs` to your project, which can be built as an independent step from your development environment.
5456

57+
## Editor Setup
58+
59+
MaterialX should work in any editor that supports CMake, or that CMake can generate a project for.
60+
Some common Editors are listed here to help developers get started.
61+
62+
### CLion
63+
64+
[CLion](https://www.jetbrains.com/clion/) is a cross-platform IDE that can be used to develop MaterialX.
65+
Additionally, it includes CMake and is free for non-commercial Use.
66+
67+
To get started with CLion, open the MaterialX repository directly, and it will load the CMake project for you.
68+
If you want to enable features like Python, go to `Settings -> Build, Execution and Deployment -> CMake` and configure
69+
the CMake Options, for example:
70+
71+
```
72+
-DMATERIALX_BUILD_PYTHON=ON
73+
-DMATERIALX_BUILD_VIEWER=ON
74+
-DMATERIALX_BUILD_GRAPH_EDITOR=ON
75+
```
76+
77+
To build, either select `Build -> Build Project` or select a specific configuration to build.
78+
To install, select `Build -> Install`
79+
5580
## Installing MaterialX
5681

5782
Building the `install` target of your project will install the MaterialX C++ and Python libraries to the folder specified by the `CMAKE_INSTALL_PREFIX` setting, and will install MaterialX Python as a third-party library in your Python environment. Installation of MaterialX Python as a third-party library can be disabled by setting `MATERIALX_INSTALL_PYTHON` to `OFF`.

libraries/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ This folder contains the standard data libraries for MaterialX, providing declar
7575
- point, directional, spot
7676
- Shader generation does not currently support:
7777
- `displacementshader` and `volumeshader` nodes for hardware shading targets (GLSL, MSL).
78-
- `hextiledimage` and `hextilednormalmap` for MSL, OSL, and MDL.
78+
- `hextiledimage` and `hextilednormalmap` for OSL and MDL.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
void mx_surface_unlit(float emission, vec3 emission_color, float transmission, vec3 transmission_color, float opacity, out surfaceshader result)
3+
{
4+
result.color = emission * emission_color * opacity;
5+
result.transparency = mix(vec3(1.0), transmission * transmission_color, opacity);
6+
}

libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<implementation name="IM_surfacematerial_genglsl" nodedef="ND_surfacematerial" target="genglsl" />
1616

1717
<!-- <surface_unlit> -->
18-
<implementation name="IM_surface_unlit_genglsl" nodedef="ND_surface_unlit" target="genglsl" />
18+
<implementation name="IM_surface_unlit_genglsl" nodedef="ND_surface_unlit" file="mx_surface_unlit.glsl" function="mx_surface_unlit" target="genglsl" />
1919

2020
<!-- ======================================================================== -->
2121
<!-- Texture nodes -->

libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
<!-- <surfacematerial> -->
1515
<implementation name="IM_surfacematerial_genmsl" nodedef="ND_surfacematerial" target="genmsl" />
1616

17-
<!-- <surface_unlit> -->
18-
<implementation name="IM_surface_unlit_genmsl" nodedef="ND_surface_unlit" target="genmsl" />
19-
2017
<!-- ======================================================================== -->
2118
<!-- Texture nodes -->
2219
<!-- ======================================================================== -->
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0"?>
2+
<materialx version="1.39">
3+
<nodegraph name="Parent_Token_Graph">
4+
<token name="Image_Name" type="string" value="cloth" uiname="Image Name" />
5+
<token name="Image_Extension" type="string" value="png" uiname="Image Extension" />
6+
<input name="Image_Filename" type="filename" uniform="true" value="resources/Images/[Image_Name].[Image_Extension]" />
7+
<tiledimage name="tiledimage" type="color3" nodedef="ND_tiledimage_color3">
8+
<input name="file" type="filename" uniform="true" interfacename="Image_Filename" />
9+
</tiledimage>
10+
<output name="out" type="color3" nodename="tiledimage" />
11+
</nodegraph>
12+
<nodegraph name="Sibling_Token">
13+
<tiledimage name="tiledimage" type="color3" nodedef="ND_tiledimage_color3">
14+
<token name="Image_Name" type="string" value="wood_color" uiname="Image Resolution" />
15+
<token name="Image_Extension" type="string" value="jpg" uiname="Image Extension" />
16+
<input name="file" type="filename" uniform="true" value="resources/images/[Image_Name].[Image_Extension]" />
17+
</tiledimage>
18+
<output name="out" type="color3" nodename="tiledimage" />
19+
</nodegraph>
20+
<token name="Brass_Image_Extension" type="string" value="jpg" uiname="Image Extension" />
21+
<nodegraph name="Tokenized_Image_top_level">
22+
<tiledimage name="tiledimage" type="color3" nodedef="ND_tiledimage_color3">
23+
<token name="Brass_Image_Extension" type="string" value="png" uiname="Image Extension" />
24+
<input name="file" type="filename" uniform="true" value="resources/Images/brass_color.[Brass_Image_Extension]" />
25+
</tiledimage>
26+
<output name="out" type="color3" nodename="tiledimage" />
27+
</nodegraph>
28+
<nodedef name="ND_token" node="token_image">
29+
<token name="Image_Name" type="string" value="grid" uiname="Image Name" />
30+
<token name="Image_Extension" type="string" value="png" uiname="Image Extension" />
31+
<output name="out" type="color3" />
32+
</nodedef>
33+
<nodegraph name="NG_token" nodedef="ND_token">
34+
<tiledimage name="tiledimage" type="color3" nodedef="ND_tiledimage_color3">
35+
<input name="file" type="filename" uniform="true" value="resources/Images/[Image_Name].[Image_Extension]" />
36+
</tiledimage>
37+
<output name="out" type="color3" nodename="tiledimage" />
38+
</nodegraph>
39+
<nodegraph name="token_nodedef_graph">
40+
<token_image name="token_image1" type="color3" />
41+
<output name="out" type="color3" nodename="token_image1" />
42+
</nodegraph>
43+
<surface_unlit name="Parent_Token_Shader" type="surfaceshader">
44+
<input name="emission_color" type="color3" output="out" nodegraph="Parent_Token_Graph" />
45+
</surface_unlit>
46+
<surface_unlit name="Token_Nodedef_Shader" type="surfaceshader">
47+
<input name="emission_color" type="color3" output="out" nodegraph="token_nodedef_graph" />
48+
</surface_unlit>
49+
<surface_unlit name="TopLevel_Token_Shader" type="surfaceshader">
50+
<input name="emission_color" type="color3" output="out" nodegraph="Tokenized_Image_top_level" />
51+
</surface_unlit>
52+
<surface_unlit name="Token_Silbing_Shader" type="surfaceshader">
53+
<input name="emission_color" type="color3" output="out" nodegraph="Sibling_Token" />
54+
</surface_unlit>
55+
<surfacematerial name="Token_Silbing_Material" type="material">
56+
<input name="surfaceshader" type="surfaceshader" nodename="Token_Silbing_Shader" />
57+
</surfacematerial>
58+
<surfacematerial name="Token_Nodedef_Material" type="material">
59+
<input name="surfaceshader" type="surfaceshader" nodename="Token_Nodedef_Shader" />
60+
</surfacematerial>
61+
<surfacematerial name="TopLevel_Token_Material" type="material">
62+
<input name="surfaceshader" type="surfaceshader" nodename="TopLevel_Token_Shader" />
63+
</surfacematerial>
64+
<surfacematerial name="Parent_Token_Material" type="material">
65+
<input name="surfaceshader" type="surfaceshader" nodename="Parent_Token_Shader" />
66+
</surfacematerial>
67+
</materialx>

source/MaterialXCore/Node.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ bool Node::validate(string* message) const
199199
string matchMessage;
200200
bool exactMatch = hasExactInputMatch(nodeDef, &matchMessage);
201201
validateRequire(exactMatch, res, message, "Node interface error: " + matchMessage);
202+
203+
const vector<OutputPtr>& activeOutputs = nodeDef->getActiveOutputs();
204+
const size_t numActiveOutputs = activeOutputs.size();
205+
if (numActiveOutputs > 1)
206+
{
207+
validateRequire(getType() == MULTI_OUTPUT_TYPE_STRING, res, message, "Node type is not 'multioutput' for node with multiple outputs");
208+
}
209+
else if (numActiveOutputs == 1)
210+
{
211+
validateRequire(getType() == activeOutputs[0]->getType(), res, message, "Node type does not match output port type");
212+
}
202213
}
203214
else
204215
{

source/MaterialXGenGlsl/GlslShaderGenerator.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include <MaterialXGenGlsl/GlslSyntax.h>
99
#include <MaterialXGenGlsl/Nodes/SurfaceNodeGlsl.h>
10-
#include <MaterialXGenGlsl/Nodes/UnlitSurfaceNodeGlsl.h>
1110
#include <MaterialXGenGlsl/Nodes/LightNodeGlsl.h>
1211
#include <MaterialXGenGlsl/Nodes/LightCompoundNodeGlsl.h>
1312
#include <MaterialXGenGlsl/Nodes/LightShaderNodeGlsl.h>
@@ -87,7 +86,6 @@ GlslShaderGenerator::GlslShaderGenerator(TypeSystemPtr typeSystem) :
8786

8887
// <!-- <surface> -->
8988
registerImplementation("IM_surface_" + GlslShaderGenerator::TARGET, SurfaceNodeGlsl::create);
90-
registerImplementation("IM_surface_unlit_" + GlslShaderGenerator::TARGET, UnlitSurfaceNodeGlsl::create);
9189

9290
// <!-- <light> -->
9391
registerImplementation("IM_light_" + GlslShaderGenerator::TARGET, LightNodeGlsl::create);

source/MaterialXGenGlsl/Nodes/UnlitSurfaceNodeGlsl.cpp

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)