forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit legacy materials (#1398)
* Initial commit legacy materials This commit includes: - all Legacy (Protein) classes - procedural nodes (checker, noise, turbulence 2d/3d) - utilities (stain, normals combine nodes) For now all nodes are under "adsk_legacy" group, except the turbulence ones that might be ok to be added to the standard lib. Becasue of a bug in the handling of namespaces in the Graph Editor all namespaces are set to "". Bug: AcademySoftwareFoundation#1695 * Test files for legacy material This includes a single MTLX file and a set of textures. The MTLX file can be loaded in MaterialX Viewer and materials selected from the UI * Adding values to test file Adding values to all inputs to avoid warnings. This files generates no warning messages when loaded in MaterialX viewer Also fixing a small typo in the defs file * USD test file This is a USD test file that can be loaded in usdview to test the same materials that the legacy_materials_test.mtlx tests in MaterialX viewer. Open the file in usdview, select the ShaderBall object and in the Meta data panel you can select a variant for each material class. The legacy materials node defs are also updated to remove a stub for namespace that was causing trouble in usdview (but was ok in MaterialX viewer). A typo in the comments was also fixed. * Stubs for OSL and MDL turbulence noise Stubs for implementation of: - turbulence2d_float - turbulence3d_float in OSL and MDL. Currently returning a solid color. This is just to check the build warnings. * Test for matching implementation count Just a test to see if hardcoded expected skip count does influence overall implementation counters and failure to match. Testing for glsl only. * Revert "Test for matching implementation count" This reverts commit 12e011f. * Added test mtlx file for unused nodedefs Tests were failing because the node turbulence2D was defined but never used in any TestSuite file. Adding a other.mtlx as a container for these orphans nodes. Note that for consistency I also added turbulence3d in there, even if not necessary as it's used in the main material test file.
- Loading branch information
Showing
40 changed files
with
3,228 additions
and
0 deletions.
There are no files selected for viewing
333 changes: 333 additions & 0 deletions
333
contrib/adsk/libraries/adsklib/adsklib_legacy_defs.mtlx
Large diffs are not rendered by default.
Oops, something went wrong.
2,219 changes: 2,219 additions & 0 deletions
2,219
contrib/adsk/libraries/adsklib/adsklib_legacy_ng.mtlx
Large diffs are not rendered by default.
Oops, something went wrong.
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
23 changes: 23 additions & 0 deletions
23
contrib/adsk/libraries/adsklib/genglsl/mx_turbulence2d_float.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,23 @@ | ||
#include "../../stdlib/genglsl/lib/mx_noise.glsl" | ||
|
||
void mx_turbulence2d_float(float amplitude, float octaves, vec2 texcoord, out float result) | ||
{ | ||
float sum = 0.0; | ||
float scale = 1.0; | ||
|
||
// Accumulate the required number of octaves of noise. | ||
float i = 0.0; | ||
for (i = octaves; i >= 1.0; i -= 1.0) { | ||
float value = mx_perlin_noise_float(texcoord * scale) / scale; | ||
sum += abs(value); | ||
scale *= 2.0; | ||
} | ||
|
||
// Add a portion of the remaining octave, if any. | ||
if (i > 0.0) { | ||
float value = mx_perlin_noise_float(texcoord * scale) / scale; | ||
sum += abs(value) * i; | ||
} | ||
|
||
result = sum * amplitude; | ||
} |
23 changes: 23 additions & 0 deletions
23
contrib/adsk/libraries/adsklib/genglsl/mx_turbulence3d_float.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,23 @@ | ||
#include "../../stdlib/genglsl/lib/mx_noise.glsl" | ||
|
||
void mx_turbulence3d_float(float amplitude, float octaves, vec3 position, out float result) | ||
{ | ||
float sum = 0.0; | ||
float scale = 1.0; | ||
|
||
// Accumulate the required number of octaves of noise. | ||
float i = 0.0; | ||
for (i = octaves; i >= 1.0; i -= 1.0) { | ||
float value = mx_perlin_noise_float(position * scale) / scale; | ||
sum += abs(value); | ||
scale *= 2.0; | ||
} | ||
|
||
// Add a portion of the remaining octave, if any. | ||
if (i > 0.0) { | ||
float value = mx_perlin_noise_float(position * scale) / scale; | ||
sum += abs(value) * i; | ||
} | ||
|
||
result = sum * amplitude; | ||
} |
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
4 changes: 4 additions & 0 deletions
4
contrib/adsk/libraries/adsklib/genosl/mx_turbulence2d_float.osl
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,4 @@ | ||
void mx_turbulence2d_float(float amplitude, float octaves, vector2 texcoord, output float result) | ||
{ | ||
result = 0.5; | ||
} |
4 changes: 4 additions & 0 deletions
4
contrib/adsk/libraries/adsklib/genosl/mx_turbulence3d_float.osl
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,4 @@ | ||
void mx_turbulence3d_float(float amplitude, float octaves, vector position, output float result) | ||
{ | ||
result = 0.5; | ||
} |
131 changes: 131 additions & 0 deletions
131
...resources/Materials/TestSuite/adsklib/legacy/ShaderBall_USD_MaterialX_sampler_Legacy.usda
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,131 @@ | ||
#usda 1.0 | ||
( | ||
defaultPrim = "ShaderBall" | ||
metersPerUnit = 0.01 | ||
upAxis = "Y" | ||
) | ||
|
||
over "ShaderBall" ( | ||
references = @one_ball.usda@ | ||
variants = { | ||
string shadingVariant = "Mirror" | ||
} | ||
prepend variantSets = "shadingVariant" | ||
) | ||
{ | ||
over "one_ball_MeshShape" ( | ||
prepend apiSchemas = ["MaterialBindingAPI"] | ||
) | ||
{ | ||
} | ||
|
||
variantSet "shadingVariant" = { | ||
"Generic" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_generic> | ||
|
||
} | ||
} | ||
"Mirror" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_mirror> | ||
|
||
} | ||
} | ||
"Hardwood" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_hardwood> | ||
|
||
} | ||
} | ||
"Metal" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_metal> | ||
|
||
} | ||
} | ||
"Ceramic" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_ceramic> | ||
|
||
} | ||
} | ||
"Concrete" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_concrete> | ||
|
||
} | ||
} | ||
"Glazing" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_glazing> | ||
|
||
} | ||
} | ||
"Masonry" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_masonry> | ||
|
||
} | ||
} | ||
"MetallicPaint" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_metallicpaint> | ||
|
||
} | ||
} | ||
"Glass" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_glass> | ||
|
||
} | ||
} | ||
"Stone" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_stone> | ||
|
||
} | ||
} | ||
"WallPaint" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_wallpaint> | ||
|
||
} | ||
} | ||
"Water" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_water> | ||
|
||
} | ||
} | ||
"Plastic" { | ||
over "one_ball_MeshShape" | ||
{ | ||
rel material:binding = </MaterialX/Materials/M_legacy_plastic> | ||
|
||
} | ||
} | ||
} | ||
} | ||
|
||
over "MaterialX" | ||
( | ||
references = [ | ||
@legacy_materials_test.mtlx@</MaterialX>, | ||
] | ||
) | ||
{ | ||
} |
Oops, something went wrong.