From 3d59c69cdb17ba9759b0d79bbbcf7e24347aa7eb Mon Sep 17 00:00:00 2001 From: Roberto Ziche Date: Mon, 5 Feb 2024 16:43:08 -0800 Subject: [PATCH] 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: https://github.com/AcademySoftwareFoundation/MaterialX/issues/1695 --- .../adsklib/adsklib_legacy_defs.mtlx | 333 +++ .../libraries/adsklib/adsklib_legacy_ng.mtlx | 2219 +++++++++++++++++ .../adsklib/genglsl/adsklib_genglsl_impl.mtlx | 4 + .../genglsl/mx_turbulence2d_float.glsl | 23 + .../genglsl/mx_turbulence3d_float.glsl | 23 + 5 files changed, 2602 insertions(+) create mode 100644 contrib/adsk/libraries/adsklib/adsklib_legacy_defs.mtlx create mode 100644 contrib/adsk/libraries/adsklib/adsklib_legacy_ng.mtlx create mode 100644 contrib/adsk/libraries/adsklib/genglsl/mx_turbulence2d_float.glsl create mode 100644 contrib/adsk/libraries/adsklib/genglsl/mx_turbulence3d_float.glsl diff --git a/contrib/adsk/libraries/adsklib/adsklib_legacy_defs.mtlx b/contrib/adsk/libraries/adsklib/adsklib_legacy_defs.mtlx new file mode 100644 index 0000000000..1e9a7a805f --- /dev/null +++ b/contrib/adsk/libraries/adsklib/adsklib_legacy_defs.mtlx @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/adsk/libraries/adsklib/adsklib_legacy_ng.mtlx b/contrib/adsk/libraries/adsklib/adsklib_legacy_ng.mtlx new file mode 100644 index 0000000000..9cc2d53ab6 --- /dev/null +++ b/contrib/adsk/libraries/adsklib/adsklib_legacy_ng.mtlx @@ -0,0 +1,2219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/adsk/libraries/adsklib/genglsl/adsklib_genglsl_impl.mtlx b/contrib/adsk/libraries/adsklib/genglsl/adsklib_genglsl_impl.mtlx index 9d8e2e2661..55b209a7d9 100644 --- a/contrib/adsk/libraries/adsklib/genglsl/adsklib_genglsl_impl.mtlx +++ b/contrib/adsk/libraries/adsklib/genglsl/adsklib_genglsl_impl.mtlx @@ -7,4 +7,8 @@ --> + + + + diff --git a/contrib/adsk/libraries/adsklib/genglsl/mx_turbulence2d_float.glsl b/contrib/adsk/libraries/adsklib/genglsl/mx_turbulence2d_float.glsl new file mode 100644 index 0000000000..450ce03e5c --- /dev/null +++ b/contrib/adsk/libraries/adsklib/genglsl/mx_turbulence2d_float.glsl @@ -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; +} diff --git a/contrib/adsk/libraries/adsklib/genglsl/mx_turbulence3d_float.glsl b/contrib/adsk/libraries/adsklib/genglsl/mx_turbulence3d_float.glsl new file mode 100644 index 0000000000..7ebce11c38 --- /dev/null +++ b/contrib/adsk/libraries/adsklib/genglsl/mx_turbulence3d_float.glsl @@ -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; +}