forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add enumeration support to web viewer (AcademySoftwareFoundation#1632) - Scan for `enum` and `enumvalues` if attributes exist on input. If no `enumvalues` exist then map to "default" of 0..<enum list size>. - Create a drop-down for each enumerated input. * Initial nprlib with viewdirection node (AcademySoftwareFoundation#1631) This changelist introduces an NPR (non-photorealistic rendering) data library to MaterialX, initially consisting of a single `viewdirection` node. The NPR data library is designed for the portable expression of artistic, non-physically-based materials, with common examples being cartoon shading, architectural diagrams, and edge highlighting. In future versions of MaterialX, we expect this data library to be extended with additional primitives and artist-facing graphs as they are requested by the graphics community and approved by the MaterialX TSC. For shader generation, MaterialX initially supports the NPR data library in GLSL, ESSL, MSL, and OSL, with MDL being omitted for now, based on intentional restrictions in its design philosophy. * Improve shader generation for viewdirection This changelist improves shader generation logic for the new viewdirection node, allowing it to work correctly in derived hardware languages such as ESSL. * Add creatematrix nodes to build matrices from vectors (AcademySoftwareFoundation#1553) I'm opening this PR to add creatematrix, a constructor for Matrix33 from 3 Vector3s, Matrix44 from 4 Vector3s and Matrix44 from 4 Vector4s from the specification document (https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/Specification/MaterialX.Specification.md#math-nodes). --------- Co-authored-by: Jonathan Stone <[email protected]> Co-authored-by: Frieder Erdmann <[email protected]>
- Loading branch information
1 parent
ec8482c
commit 6ef3b95
Showing
29 changed files
with
528 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38"> | ||
<!-- | ||
Copyright Contributors to the MaterialX Project | ||
SPDX-License-Identifier: Apache-2.0 | ||
Declarations for GLSL implementations of standard nodes included in the MaterialX specification. | ||
--> | ||
|
||
<!-- ======================================================================== --> | ||
<!-- View-dependent nodes --> | ||
<!-- ======================================================================== --> | ||
|
||
<!-- <viewdirection> --> | ||
<implementation name="IM_viewdirection_vector3_genglsl" nodedef="ND_viewdirection_vector3" target="genglsl"/> | ||
|
||
</materialx> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38"> | ||
<!-- | ||
Copyright Contributors to the MaterialX Project | ||
SPDX-License-Identifier: Apache-2.0 | ||
Declarations for MDL implementations of standard nodes included in the MaterialX specification. | ||
--> | ||
|
||
<!-- ======================================================================== --> | ||
<!-- View-dependent nodes --> | ||
<!-- ======================================================================== --> | ||
|
||
<!-- <viewdirection> --> | ||
<implementation name="IM_viewdirection_vector3_genmdl" nodedef="ND_viewdirection_vector3" sourcecode="mx::stdlib::mx_viewdirection_vector3()" target="genmdl"/> | ||
|
||
</materialx> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38"> | ||
<!-- | ||
Copyright Contributors to the MaterialX Project | ||
SPDX-License-Identifier: Apache-2.0 | ||
Declarations for MSL implementations of standard nodes included in the MaterialX specification. | ||
--> | ||
|
||
<!-- ======================================================================== --> | ||
<!-- View-dependent nodes --> | ||
<!-- ======================================================================== --> | ||
|
||
<!-- <viewdirection> --> | ||
<implementation name="IM_viewdirection_vector3_genmsl" nodedef="ND_viewdirection_vector3" target="genmsl"/> | ||
|
||
</materialx> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38"> | ||
<!-- | ||
Copyright Contributors to the MaterialX Project | ||
SPDX-License-Identifier: Apache-2.0 | ||
Declarations for OSL implementations of standard nodes included in the MaterialX specification. | ||
--> | ||
|
||
<!-- ======================================================================== --> | ||
<!-- View-dependent nodes --> | ||
<!-- ======================================================================== --> | ||
|
||
<!-- <viewdirection> --> | ||
<implementation name="IM_viewdirection_vector3_genosl" nodedef="ND_viewdirection_vector3" sourcecode="transform({{space}}, I)" target="genosl" /> | ||
|
||
</materialx> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38"> | ||
<!-- | ||
Copyright Contributors to the MaterialX Project | ||
SPDX-License-Identifier: Apache-2.0 | ||
Declarations of standard data types and nodes included in the MaterialX specification. | ||
--> | ||
|
||
<!-- ======================================================================== --> | ||
<!-- View-dependent nodes --> | ||
<!-- ======================================================================== --> | ||
|
||
<!-- | ||
Node: <viewdirection> | ||
The current scene view direction, as defined by the shading environment. | ||
--> | ||
<nodedef name="ND_viewdirection_vector3" node="viewdirection" nodegroup="npr"> | ||
<input name="space" type="string" value="world" enum="model,object,world" uniform="true" /> | ||
<output name="out" type="vector3" default="0.0, 0.0, 1.0" /> | ||
</nodedef> | ||
|
||
</materialx> |
6 changes: 6 additions & 0 deletions
6
libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
void mx_creatematrix_vector3_matrix33(vec3 in1, vec3 in2, vec3 in3, out mat3 result) | ||
{ | ||
result = mat3(in1.x, in1.y, in1.z, | ||
in2.x, in2.y, in2.z, | ||
in3.x, in3.y, in3.z); | ||
} |
7 changes: 7 additions & 0 deletions
7
libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
void mx_creatematrix_vector3_matrix44(vec3 in1, vec3 in2, vec3 in3, vec3 in4, out mat4 result) | ||
{ | ||
result = mat4(in1.x, in1.y, in1.z, 0.0, | ||
in2.x, in2.y, in2.z, 0.0, | ||
in3.x, in3.y, in3.z, 0.0, | ||
in4.x, in4.y, in4.z, 1.0); | ||
} |
7 changes: 7 additions & 0 deletions
7
libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
void mx_creatematrix_vector4_matrix44(vec4 in1, vec4 in2, vec4 in3, vec4 in4, out mat4 result) | ||
{ | ||
result = mat4(in1.x, in1.y, in1.z, in1.w, | ||
in2.x, in2.y, in2.z, in2.w, | ||
in3.x, in3.y, in3.z, in3.w, | ||
in4.x, in4.y, in4.z, in4.w); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
void mx_creatematrix_vector3_matrix33(vector in1, vector in2, vector in3, out matrix result) | ||
{ | ||
result = matrix(in1.x, in1.y, in1.z, 0.0, | ||
in2.x, in2.y, in2.z, 0.0, | ||
in3.x, in3.y, in3.z, 0.0, | ||
0.0, 0.0, 0.0, 1.0); | ||
} | ||
|
||
void mx_creatematrix_vector3_matrix44(vector3 in1, vector3 in2, vector3 in3, vector3 in4, out matrix result) | ||
{ | ||
result = matrix(in1.x, in1.y, in1.z, 0.0, | ||
in2.x, in2.y, in2.z, 0.0, | ||
in3.x, in3.y, in3.z, 0.0, | ||
in4.x, in4.y, in4.z, 1.0); | ||
} | ||
|
||
void mx_creatematrix_vector4_matrix44(vector4 in1, vector4 in2, vector4 in3, vector4 in4, out matrix result) | ||
{ | ||
result = matrix(in1.x, in1.y, in1.z, in1.w, | ||
in2.x, in2.y, in2.z, in2.w, | ||
in3.x, in3.y, in3.z, in3.w, | ||
in4.x, in4.y, in4.z, in4.w); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.38" colorspace="lin_rec709"> | ||
<nodegraph name="edge_brighten"> | ||
<viewdirection name="viewdirection_vector3" type="vector3" /> | ||
<normal name="normal_vector3" type="vector3" /> | ||
<multiply name="multiply_vector3" type="vector3"> | ||
<input name="in1" type="vector3" nodename="viewdirection_vector3" /> | ||
<input name="in2" type="float" value="-1" /> | ||
</multiply> | ||
<dotproduct name="dotproduct_vector3" type="float"> | ||
<input name="in1" type="vector3" nodename="multiply_vector3" /> | ||
<input name="in2" type="vector3" nodename="normal_vector3" /> | ||
</dotproduct> | ||
<clamp name="clamp_float" type="float"> | ||
<input name="in" type="float" nodename="dotproduct_vector3" /> | ||
</clamp> | ||
<power name="power_float" type="float"> | ||
<input name="in1" type="float" nodename="clamp_float" /> | ||
<input name="in2" type="float" value="0.2" /> | ||
</power> | ||
<mix name="mix_color3" type="color3"> | ||
<input name="fg" type="color3" value="0, 0.0986187, 0.186275" /> | ||
<input name="bg" type="color3" value="0.735294, 0.735294, 0.735294" /> | ||
<input name="mix" type="float" nodename="power_float" /> | ||
</mix> | ||
<output name="out" type="color3" nodename="mix_color3" /> | ||
</nodegraph> | ||
</materialx> |
Oops, something went wrong.