-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added UISoftMin, UISoftMax, and UIStep attributes #626
Added UISoftMin, UISoftMax, and UIStep attributes #626
Conversation
- The standard_shader has been updated to use soft max for relevant parameters - The floor.mtlx example file has been updated to add extended UI attributes - The UI widgets of the MaterialXView app were updated: Float slider goes from UISoftMin to UISoftMax when available Float textbox now clamps between UIMin and UIMax and shows a spinner control when UIStep is present. Int textbox is now editable, clamps between UIMin and UIMax, and uses UIStep with the spinner control - Fixed failed unittests when running from an XFS formatted partition on Linux
auto d_type = entry->d_type; | ||
FilePath newDir = *this / path; | ||
|
||
if (d_type == DT_UNKNOWN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A filesystem, like XFS, is free to return DT_UNKNOWN if its internal data structure does not store file/dir/link info, forcing an expensive stat call.
doc="Specifies the distance light travels inside the material before its becomes exactly the transmission color according to Beer's law." /> | ||
<input name="transmission_scatter" type="color3" value="0, 0, 0" uimin="0,0,0" uimax="1,1,1" uiname="Transmission Scatter" uifolder="Transmission" uiadvanced="true" | ||
doc="Scattering coefficient of the interior medium. Suitable for a large body of liquid or one that is fairly thick, such as an ocean, honey, ice, or frosted glass." /> | ||
<input name="transmission_scatter_anisotropy" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Transmission Anisotropy" uifolder="Transmission" uiadvanced="true" | ||
doc="The amount of directional bias, or anisotropy, of the scattering." /> | ||
<input name="transmission_dispersion" type="float" value="0" uimin="0.0" uimax="100.0" uiname="Transmission Dispersion" uifolder="Transmission" uiadvanced="true" | ||
<input name="transmission_dispersion" type="float" value="0" uimin="0.0" uisoftmax="100.0" uiname="Transmission Dispersion" uifolder="Transmission" uiadvanced="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niklasharrysson , do we want a soft max for this as it's a physical property and 100 means something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, soft max of 100 sounds good for this. It's the Dispersion Abbe number, which if enabled is normally in the range 10-70. It actually gives a higher dispersion effect the lower the number but at 0 it's disabled. So 0-100 is good, where 100 is a soft max.
@@ -2,47 +2,47 @@ | |||
- *Type*: surfaceshader | |||
- *Doc*: Autodesk standard surface shader | |||
|
|||
| Name | Type | Default Value | UI min | UI max | UI group | Description | UI Advanced | Connectable | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this got checked in by mistake :). Can you just delete the file as part of the check-in. Thanks.
infos.append(p.getType()) | ||
val = p.getValue() | ||
if infos[1] == "float": | ||
val = round(val, 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the formatting of floats.
@@ -32,6 +32,9 @@ const string ValueElement::UI_NAME_ATTRIBUTE = "uiname"; | |||
const string ValueElement::UI_FOLDER_ATTRIBUTE = "uifolder"; | |||
const string ValueElement::UI_MIN_ATTRIBUTE = "uimin"; | |||
const string ValueElement::UI_MAX_ATTRIBUTE = "uimax"; | |||
const string ValueElement::UI_SOFT_MIN_ATTRIBUTE = "uisoftmin"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niklasharrysson . Another question for you. Is uimin/uimax hard min and max, or did we want the reverse logic that uimin, uimax are soft min/max and we need to add in a min/max?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bernardkwok I think the current logic is good. So basically we let the UI handle clamping of values, by having uimin/uimax represent hard limits for the UI, and let uisoftmin/uisoftmax be the initial UI widget ranges. So we avoid having to handle clamping in the core API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
libraries/bxdf/standard_surface.mtlx
Outdated
doc="Index of refraction for specular reflection." /> | ||
<input name="specular_anisotropy" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Specular Anisotropy" uifolder="Specular" uiadvanced="true" | ||
doc="The directional bias of reflected and transmitted light resulting in materials appearing rougher or glossier in certain directions." /> | ||
<input name="specular_rotation" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Specular Rotation" uifolder="Specular" uiadvanced="true" | ||
<input name="specular_rotation" type="float" value="0" uisoftmin="0.0" uisoftmax="1.0" uiname="Specular Rotation" uifolder="Specular" uiadvanced="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rotation should stay in [0, 1] "hard" range. This is internally mapped to radians where 1.0 gives full circle, so there is never a need to go higher than 1.0.
libraries/bxdf/standard_surface.mtlx
Outdated
doc="Dispersion amount, describing how much the index of refraction varies across wavelengths." /> | ||
<input name="transmission_extra_roughness" type="float" value="0" uimin="0.0" uimax="1.0" uiname="Transmission Roughness" uifolder="Transmission" uiadvanced="true" | ||
<input name="transmission_extra_roughness" type="float" value="0" uisoftmin="0.0" uisoftmax="1.0" uiname="Transmission Roughness" uifolder="Transmission" uiadvanced="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be [-1, 1] hard range. It's an add term to specular roughness which itself is [0,1].
libraries/bxdf/standard_surface.mtlx
Outdated
@@ -63,21 +63,21 @@ | |||
doc="The roughness of the clear-coat reflections. The lower the value, the sharper the reflection." /> | |||
<input name="coat_anisotropy" type="float" value="0.0" uimin="0.0" uimax="1.0" uiname="Coat Anisotropy" uifolder="Coat" uiadvanced="true" | |||
doc="The amount of directional bias, or anisotropy, of the clear-coat layer." /> | |||
<input name="coat_rotation" type="float" value="0.0" uimin="0.0" uimax="1.0" uiname="Coat Rotation" uifolder="Coat" uiadvanced="true" | |||
<input name="coat_rotation" type="float" value="0.0" uisoftmin="0.0" uisoftmax="1.0" uiname="Coat Rotation" uifolder="Coat" uiadvanced="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as specular rotation, could be hard [0,1].
libraries/bxdf/standard_surface.mtlx
Outdated
doc="The rotation of the anisotropic effect of the clear-coat layer." /> | ||
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uimax="3.0" uiname="Coat Index of Refraction" uifolder="Coat" | ||
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uisoftmax="3.0" uiname="Coat Index of Refraction" uifolder="Coat" | ||
doc="The index of refraction of the clear-coat layer." /> | ||
<input name="coat_normal" type="vector3" defaultgeomprop="Nworld" uimin="0,0,0" uimax="1,1,1" uiname="Coat normal" uifolder="Coat" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old error: normal should probably not have any min/max, as it's never given by the user. And the range given here is incorrect. So I think this could be removed. Maybe you could fix this as well in this PR?
libraries/bxdf/standard_surface.mtlx
Outdated
doc="The rotation of the anisotropic effect of the clear-coat layer." /> | ||
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uimax="3.0" uiname="Coat Index of Refraction" uifolder="Coat" | ||
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uisoftmax="3.0" uiname="Coat Index of Refraction" uifolder="Coat" | ||
doc="The index of refraction of the clear-coat layer." /> | ||
<input name="coat_normal" type="vector3" defaultgeomprop="Nworld" uimin="0,0,0" uimax="1,1,1" uiname="Coat normal" uifolder="Coat" | ||
doc="Input normal for clear-coat layer" /> | ||
<input name="coat_affect_color" type="float" value="0" uimin="0,0,0" uimax="1,1,1" uiname="Coat Affect Color" uifolder="Coat" uiadvanced="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old error: min/max should be float not vector
libraries/bxdf/standard_surface.mtlx
Outdated
doc="The rotation of the anisotropic effect of the clear-coat layer." /> | ||
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uimax="3.0" uiname="Coat Index of Refraction" uifolder="Coat" | ||
<input name="coat_IOR" type="float" value="1.5" uimin="0.0" uisoftmax="3.0" uiname="Coat Index of Refraction" uifolder="Coat" | ||
doc="The index of refraction of the clear-coat layer." /> | ||
<input name="coat_normal" type="vector3" defaultgeomprop="Nworld" uimin="0,0,0" uimax="1,1,1" uiname="Coat normal" uifolder="Coat" | ||
doc="Input normal for clear-coat layer" /> | ||
<input name="coat_affect_color" type="float" value="0" uimin="0,0,0" uimax="1,1,1" uiname="Coat Affect Color" uifolder="Coat" uiadvanced="true" | ||
doc="Controls the saturation of diffuse reflection and subsurface scattering below the clear-coat." /> | ||
<input name="coat_affect_roughness" type="float" value="0" uiname="Coat Affect Roughness" uifolder="Coat" uiadvanced="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here a hard range [0,1] could be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks Jerry
Main commit hash is 37ccbc55bf1988803d59eb33c5f9aeca31ae3886 * Upgrade shading models to v1.38 - Upgrade all documents in the libraries/bxdf folder to v1.38. - Adjust uniform attributes in shading model interfaces to match their specifications. - Rename a node in the implementation of standard_surface to avoid a collision with its interface. * 1.38 Autodesk Updates (#590) - Deprecation of nodes: `backfacing`, `fresnel`, `viewdirection` - Get MDL unit tests to work with 1.38 changes - Updates for TextureBaker: - restore code to prevent unoptimized path from failing. - fix `normalmap` node creation code to only copy over contents if the root of the subgraph being baked is also a `normalmap`. (the root may be a downstream node with a normalmap upstream of it). - Fix for logic to GLSL implementation of `heighttonormal` node to prevent artifacts due to math exceptions. Render test case has been updated to test more configurations. - Minor fix to image path flattening to prevent empty paths from adding search paths. * Upgrade PBS library to v1.38 - Upgrade all documents in the libraries/pbrlib folder to v1.38. - Adjust uniform attributes in node interfaces to match the specification. * Update standard library to v1.38 - Upgrade all documents in the libraries/stdlib folder to v1.38. - Adjust uniform attributes in node interfaces to match the specification. * Add support for comment elements This changelist adds support for comment elements, allowing document comments to be directly generated through the MaterialX API and preserved when loading and saving content. The mxupdate.py script has been updated to preserve MTLX comments in document upgrades. * Upgrade material test suite to v1.38 - Upgrade all documents in the resources/Materials/TestSuite folder to v1.38. - Update comments and formatting for consistency. * Streamline port connection methods - Merge output accessors for Input and PortElement for simplicity. - Simplify the implementation of Input::getConnectedNode. - Rename Input::getConnectedInterface to Input::getInterfaceInput for clarity. * Improvements to Python bindings - Add default arguments to the Python binding for MaterialX::getShaderNodes. - Add Python bindings for MATERIAL_TYPE_STRING, SURFACE_MATERIAL_NODE_STRING, and VOLUME_MATERIAL_NODE_STRING. - Add shader node logic to mxvalidate.py, making this common Python pattern part of the test suite. - Add missing deprecation warnings for ShaderRef methods. * Update documentation for v1.38 - Add specification documents for v1.38. - Minor changelog revisions for v1.38.0. - Adjust global Doxygen settings for clarity. - Fix a Doxygen comment in ShaderStage.h. * Improvements to transparency detection This changelist updates the transparency detection heuristic in MaterialXGenShader/Util.cpp for v1.38 shader nodes. There's still plenty of room for future improvement, but this implementation generates correct results for all examples in the MaterialX repository. * Improvements to search paths - In the Viewer and TextureBaker, respect input search paths for shader code as well as documents and images, applying the necessary modifications to match the expectations of the code generator. - Move the getDefaultSearchPath helper function from MaterialXGenShader to MaterialXView, since its assumptions are specific to that application. * Improvements to viewer builds - Remove library and resource copies for viewer builds, as they tend to slow down shader development. - Simplify the logic for viewer search paths, making it more robust in production contexts. * Document upgrade improvements - Align parameter-to-input conversion with the specification, now that the standard libraries have been upgraded to v1.38. - Remove legacy shader nodedefs from v1.36 documents, since they can interfere with code generation. * Update links to main branch - Update repository links to match a rename of the default branch from 'master' to 'main' (https://github.com/github/renaming). - Add support for workflow dispatch jobs in GitHub Actions. * Update badge to main branch * Autodesk : minor updates (#607) ### Changes - Refinement to optional arguments on loading libraries and documents - TextureBaker: auto-resizing output image and hashing output file names options. ### Unit Tests [mar1_unit_tests.pdf](https://github.com/materialx/MaterialX/files/6066037/mar1_unit_tests.pdf) * Documentation updates - Final updates for the v1.38 specification. - Minor update to MaterialXTest documentation. * Finalize changelog for v1.38.0 * Update development build to 1.38.1 * Fix external nanogui build (#611) 9197ee9 re-introduced linking via -lnanogui , which is redundant with the CMake variable NANOGUI_LIBRARIES for a local nano-gui build, and causes errors with an external NanoGUI install. 76a30db is the original merge where it was removed. * Image handling improvements - Simplify ImageHandler::acquireImage, making it non-virtual and removing an unused parameter. - Add protected helper method ImageHandler::loadImage. - Streamline the implementation of MaterialX::createImageStrip. * MDL texture lookup code generation updates (#615) Issues Addressed - Fixes erroneous generation of a texture_2d() reference with "/" as an argument when no value is specified. - Make texture_2d() lookups input arguments as opposed to always inlined. * Add support for UINT16 images in MaterialXRender This changelist adds support for 16-bit unsigned-integer images in MaterialXRender, allowing 16-bit TIFF files to be loaded and viewed when MaterialX is built with OpenImageIO enabled. Also: - Make ImageHandler::clearImageCache a public method. - Add missing Python bindings for the ImageHandler class. - Simplify Python bindings for the ImageLoader class. * Allow building shared libraries on Windows (#618) These changes allow MaterialX to be built under Windows with MATERIALX_BUILD_SHARED_LIBS set to true. New "MX__API" symbols exist for each library to allow classes and functions to be explicitly exported from the resulting DLLs. * Updates to GitHub CI - Upgrade Ubuntu version for GCC 10 builds. - Add test for shared libraries on Windows. * Improvements to viewer property editor This changelist implements improvements to the viewer property editor, updating its display of shading models and ungrouped inputs to v1.38 conventions. * Added initial draft for OSL closures (#614) This changelist contains the initial draft and discussion for a set of new OSL closures to represent the MaterialX PBS library. Discussion and development on this project continues in the OSL repository at https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1371. * Add brick procedural images (#625) Attribution: These images have been scanned by Autodesk and contributed to the MaterialX project. * Added hybrid texture/procedural brick example (#626) * Remove legacy texture This changelist removes a legacy texture that was referenced only in unit tests, replacing it with the standard grid texture. * Fix color asTuple methods This changelist fixes the asTuple methods for the Color3 and Color4 classes in Python. These methods are an older mechanism for casting vector/color instances to Python tuples, and the current recommended approach is to directly cast vector/color instances to tuple type. * Remove invalid interfacename attribute This changelist removes an invalid interfacename attribute from the nodegraph_nodegraph example, allowing improvements to document validation logic in the future. * Add Element::getTreeIndex method This changelist adds the Element::getTreeIndex method, which returns the breadth-first index of an element within the document tree. * Improved support for compound nodegraphs (#633) - Update shader code and UI generation to support compound nodegraphs with input bindings. - Convert the standard_surface_brick_procedural and standard_surface_marble_solid examples to compound nodegraphs with input bindings, giving them an improved UI in the property editor. - Add viewer option "Show All Inputs", which allows unbound shader inputs to be displayed in the property editor. * Clarify opacity logic in Standard Surface This changelist clarifies the opacity logic in the Standard Surface nodegraph, replacing a <swizzle> node containing an unused "param" element with the equivalent channel-specific connection. * Improvements to shader translation and baking - Add support for graph outputs with multiple bindings in shader translation. - Remove extra dot nodes that were created in shader translation, as they're no longer needed in MaterialX v1.38. - Simplify the handling of world-space nodes in shader translation and texture baking. - Rename MaterialX::connectsToNodeOfCategory to MaterialX::connectsToWorldSpaceNode for clarity. * Improvements to viewer commands - Unify the handling of output folders for all generated data (e.g. GLSL, OSL, MDL, and DOT files), defaulting to the source folder of the current material, and applying the MATERIALX_VIEW_OUTPUT_PATH environment variable if set. - Add an 'I' hotkey which reloads all images from the file system. - Change the GLSL shader-generation hotkey from 'S' to 'G' for consistency with OSL and MDL. * Update changelog for recent work * Optimizations to shader translation and baking - Remove unneeded system memory copies of baked textures, reducing the memory overhead for baking operations. - Generalize the logic for texture resolution detection, moving it from the TextureBaker class to ImageHandler::getReferencedImages and MaterialX;;getMaxDimensions. - Update getShaderNodes to return nodes in a consistent, platform-independent order. - Improve the handling of default values in shader translation. - Add an initial viewer command for shader translation. - Use texture resolution detection by default in viewer baking. * Documentation updates - Update viewer documentation for new features. - Update changelog for recent work. * Simplify material examples - Remove colorspace assignments on scalar images (only color values and images are affected by colorspace assignments). - Remove input bindings to default values. * Finalize changelog for v1.38.1 * Update development build to 1.38.2 * Improvements to library documentation - Fix a default color space name in libraries documentation. - Clarify doc strings in the Standard Surface nodedef. * Add support for GCC 11 - Add standard headers required in GCC 11 builds. - Add GCC 11 to automated testing. * Improvements to render exceptions - Rename ExceptionShaderRenderError to ExceptionRenderError, clarifying that it handles non-shading render exceptions as well. - Make the error log argument of the ExceptionRenderError constructor optional. - Simplify the use of ExceptionRenderError in GLSL and OSL rendering. * Add GLSL roughness guards This changelist adds guards for invalid roughness values in the GLSL implementations of conductor_bsdf, dielectric_bsdf, and generalized_schlick_bsdf, providing more consistent visual behavior for shading models that implement their own roughness computations. * Improvements to library documentation - Add initial documentation for the BxDF graph library. - Note the current status of OSL reference implementations. - Clarify language and unify formatting. * Add support for command-line baking in MaterialXView (#651) * Add initial Lama BxDF node definitions and tests. (#643) * Fix issue with generation of input metadata in OSL (#656) This change list fixes an issue with metadata generation for inputs of type Vector2, Vector4 and Color4. These types are custom structs in OSL, and metadata declarations with value assignments for structs are not supported. The OSL compiler raise a syntax error in these cases. With this change we prevent metadata generation for these types, so it's just a workaround. A proper fix would be to support this on OSL side, and preferably let these data types become first class native data types in OSL. * Improve transparency heuristic (#657) - Additional logic for the handling of nodegraph and nodedef configurations including more complete upstream traversal. - Add in new tests for transparency. * Initial shader translation graph This changelist introduces an initial shader translation graph from Standard Surface to UsdPreviewSurface, along with a simple Python script that converts MaterialX documents between shading models. * Fix real-world unit target inheritance (#663) Target inheritance for unit system patched. Similar to previous patch for color system. Inherited targets will properly find ancestor implementations. * Minor test changes for derived target usage (#665) - Minor change to OSLC test build option for clarity - Cleanup html script to allow for named targets to be used vs hard-coded glsl and osl - Call base whitelist to allow for common items to be set to ignore during test. * Fix regression that tokens can show up in shadernode interfaces. (#664) * Fix default value for USD preview surface roughness implementation (#660) Fix to use correct value for roughness of USD preview surface. * Fix channel names in OpenImageIO writing This changelist addresses the assignment of incorrect channel names in OpenImageIO writing, by switching from the default ImageSpec constructor to one that assigns default channel names after the channel count is known. * GLSL code structure cleanup (#658) - Add explicit casts for improved compatibility. - Add support for vertex inputs outside of structures. * Static analysis fixes - Remove unused assignments of output pointers. - Use a standard vector to represent a graph stack. - Remove an unused variable from isTransparentShaderGraph. - Clarify the interface of isTransparentShaderGraph. * Update changelog for recent work * Update Disney BRDF paper links * Improvements to shader generation (#677) - Update color space names and methods to follow ACES 1.2 conventions (e.g. lin_rec709, g22_rec709), while maintaining compatibility with legacy names (e.g. gamma22). - Improve sharing of code and constants for color transforms (e.g. defining mx_srgb_texture_to_lin_rec709 just once per shading language). Ultimately, we can improve this sharing further by defining color transforms as graphs. - Remove unneeded includes in GLSL shader generation (e.g. pbrlib support in pure pattern graphs). * Optimizations to GLSL generation - Move PBS-specific code from mx_math to mx_microfacet. - Remove unused code from mx_math. * Optimizations to shader generation (#679) - Merge duplicate shading inputs for filtered importance sampling. - Merge helper methods for artistic IOR. - Remove an extra include for lit materials in GLSL. * Node flattening issue fix (#672) * uimin/uimax/uisoftmax added to UsdPreviewSurface parameters (#680) * Move ScopedTimer to MaterialXRender (#681) This changelist refactors the ScopedTimer class and moves it from MaterialXTest to MaterialXRender, making timing facilities available across rendering implementations. * Optimization to texture baking Clear the image cache after each set of shader inputs is baked, in order to reduce the system memory overhead for processing materials with multiple UDIMs. * Static analysis fixes - Assign explicitly-defaulted constructors to vector and matrix classes. - Use std::make_shared in node creation methods. - Prefer std::array to std::vector for immutable data. - Add null checks for missing viewer materials. - Additional minor simplifications to code. * Additional color space updates This changelist makes two additional updates to the default color space names, based on feedback from Doug Walker: - Use the standard "rec709_display" instead of "g24_rec709". - Use the standard "acescg" as the preferred name, with "lin_ap1" being a supported alias. * Transfer material attributes in upgrade This changelist improves the upgrade logic for legacy MaterialX documents, transferring any custom attributes present in a material element to its corresponding material node. * Fix typo in OSL cm implementation (#687) * Fix typos in MDL color management * Update changelog for recent work * Add rational curve fit for sheen albedo (#690) * Improvements to sheen rendering (#691) - Add a ground-truth GPU Monte Carlo mode for sheen albedo. - Add a GPU-generated table mode for sheen albedo, and make this the default in the viewer. - Update curve constants for sheen albedo based on newly-generated data. - Increase the minimum sheen roughness to 0.005, in order to avoid rendering artifacts in Monte Carlo mode. - Minor clarity improvements to directional albedo functions. * Add rational curve fit for GGX albedo (#692) This changelist adds a rational curve fit for GGX directional albedo, as a potential replacement for the classic Karis mobile approximation. The new rational curve is generally more accurate at grazing angles than the Karis approximation, while maintaining comparable shading complexity. * Fix inconsistency in mix nodes default value (#697) * Improved rational curve fit for sheen albedo (#698) This changelist improves the rational curve fit for sheen directional albedo, generating results that are significantly closer to Monte Carlo reference for low roughness values. Additionally, it increases the size of the directional albedo table to 128, allowing a correct match for sheen direction albedo when table-based rendering is used. * Update MaterialXView to handle multiple meshes. (#699) * Improved rational curve fit for GGX albedo (#700) This changelist improves the visual quality of the rational curve fit for GGX albedo, generating results that are very close to Monte Carlo ground truth. Since this improvement comes at the cost of additional shader instructions, it's worthwhile to discuss the tradeoffs before moving forward. * File template naming update for TextureBaker (#702) Added file template naming and updated naming for baked texture filenames. * Template variables include: `$ASSET`, `$INPUT`, `$EXTENSION`, `$NAMEPATH`, `$MATERIAL`, `$SHADINGMODEL`, `$UDIM`, `$UDIMPREFIX` * Variable values are inferred accordingly * For example, `$ASSET` is inferred from the output socket's `activeSourceUri` * Note `$UDIMPREFIX` and `$UDIM` is only added when udims are detected * Default filename template is `$MATERIAL_$SHADINGMODEL_$INPUT$UDIMPREFIX$UDIM.$EXTENSION` * Adding `.$EXTENSION` in template is optional (`.$EXTENSION` will be added if not specified) * Use VNDF sampling for GGX directional albedo (#706) This changelist updates the Monte Carlo computation for GGX directional albedo to use VNDF sampling (http://jcgt.org/published/0007/04/01/paper.pdf), creating a notable improvement in its accuracy. Additionally, the rational quadratic fit for for GGX directional albedo has been rebuilt from the latest Monte Carlo data, creating a smoother, more accurate fit. * ESSL code generator addition (#693) Web merge part 2: ESSL code generator Previous check-in has modified other GLSL code snippets and shader node code generators to produce ESSL and GLSL compliant code such as avoiding explicit casts. This formally introduces a new generator to which shares existing GLSL code but is injected in into the final shader in a custom manner. This change includes the following: 1. Refactors some of the underlying code in the GLSL generator to be modularized into virtual methods which can be overridden by the derived ESSL shader class. 2. Some pertinent points including modifying the language directives, and not initializing any uniforms. 3. From a usage perspective: - Include Python wrappers for this generator and add in a Python utility to allow arbitrary language output. (`generateshader`) - Add the ability to output ESSL source code from MaterialXView 4. ESSL implementation checking uses `generateshader` as part of CI. 5. `glslang` is setup as part of CI with `glslangValidator` being invoked for ESSL and GLSL syntax checking of vertex and pixel shader stages. (Note: This covers all of the `pbr` library nodes + some stdlib nodes based on usage in the examples materials. basic infrastructure is now available.) (Note: Actual WASM testing is not part of this check-in but will use this generator. ) As part of this CI has been modified a bit to reduce the number of builds for pushes vs PRs. 6. Some minor additional fixes for GLSL / ESSL source code implementation compliance in the pbr library. * Documentation updates - Update directional albedo naming conventions for recent work. - Update changelog for recent work. * Static analysis fixes Clarify null checks for ColorManagementSystemPtr and UnitSystemPtr arguments in shader generation. * Finalize changelog for v1.38.2 * Update development build to 1.38.3 * Add support for Xcode 13 - Suppress NanoGUI warnings for Xcode 13. - Add Xcode 13 to automated testing. * Main page updates - Update project description to align with recent work and collaborations. - Update links to pre-built binaries. - Add a link to the ASWF OSD 2021 slide deck. * Set transmission roughness to zero in UsdPreviewSurface (#718) * Texture filename template naming variable fix (#721) * Main page updates - Minor refinements to the introduction. - Add the MaterialX logo. * Initial clang-format file This changelist adds an initial clang-format file to the MaterialX project, allowing developers to align their code to its conventions on demand. For now, the use of Clang formatting is optional, and we should consider its integration into automated testing as we gain more experience with its usage. The new clang-format file requires Clang 13 or newer, as it leverages newly-added formatting options for lambdas (https://clang.llvm.org/docs/ClangFormatStyleOptions.html). * Clarify interface of getGeometryBindings This changelist clarifies the interface of the getGeometryBindings function, expressing its first argument more precisely as a ConstNodePtr, and adding a missing default value for its second argument. * Add version defines to MaterialXCore This changelist adds preprocessor definitions for the API version to MaterialXCore, allowing applications to detect version details at compile time. The new preprocessor definitions are accessed through a Version.h file that is generated at MaterialX build time. * Fix skipped inputs in createUIPropertyGroups This changelist fixes a bug that caused shader inputs to be skipped in createUIPropertyGroups. Instead of computing breadth-first indices in a dedicated (and inaccurate) method, we now compute exact depth-first indices by traversing the document tree in advance. The original inaccurate method has been removed, as it is otherwise unused in the MaterialX codebase. * Improvements to Linux Clang support - Add Linux Clang 9, 11, and 12 builds to the GitHub Actions matrix. - Improve compiler handling in MaterialXRenderGlsl and MaterialXView. - Minor refinements to generateshader.py testing. * Upgrade to Xcode 12.5.1 This changelist upgrades GitHub Actions builds to Xcode 12.5.1, as Xcode 12.5 has been removed from the MacOS 11 virtual environment. * Fix search path for XML stream loading (#707) The XML stream loading path does not take into consideration search paths. This affects cases such as when an xinclude is in being loaded from memory. This makes the functionality orthogonal to the file based XML API. Note: this in memory xinclude workflow can be used for loading for web browsing. Additional small API addition to set current file path. * Add color transforms to Image class This changelist adds two color transform methods to the Image class in MaterialXRender, Image::applyMatrixTransform and Image::applyGammaTransform. Additionally, it adds an Image::copy method that supports changes of channel count and base type. * Apply Clang formatting to MaterialXCore This changelist applies Clang formatting to the C++ source in MaterialXCore, providing improvements in coding style consistency. Additionally, a new setting for preprocessor directive formatting has been added to the root clang-format file. * Fix order of installation settings This changelist fixes the order of installation settings in the root CMakeLists.txt, making sure that MATERIALX_INSTALL_STDLIB_PATH is defined before it is referenced. * Apply Clang formatting to MaterialXFormat This changelist applies Clang formatting to the C++ source in MaterialXFormat, providing improvements in coding style consistency. * Refactoring of BSDF handling in shader generation (#747) This change list is a refactor of some concepts for BSDF handling in MaterialX shader generation. The two main changes are: **1. Propagation of BSDF throughput** In BSDF evaluation the result has been separated into _response_ and _throughput_. Response is the normal fraction of light reflected, while throughput is the remaining fraction of light transmitted after reflection and absorption. For opaque substances this throughput is always zero, since all light that is not reflected is then absorbed. A typical example is conductors/metals. But for dielectric media light can transmit, possibly through multiple vertical layers, and here the throughput is used to track the fraction of light remaining as it arrives at each interface in a layer stack. This makes it possible to calculate vertical layering on any two BSDF's or mixtures of BSDF's. This was not possible before when vertical layering was done by transforming the BSDF layer operator graph into a nesting of BSDFs, and only a limited number of BSDFs support such nested layering. The new changes applies mainly to GLSL codegen. For now it also applies to OSL codegen, since we currently calculate vertical layering in shader code, outside from the closures. For longer term, when the OSL reference closures are implemented, this should be handled inside the closures instead. For MDL only BSDF nesting can be used for layering, so this change does not apply there. Other improvements can be done on MDL side to support more layering configuration, by transforming the layering graphs, but his is future work and not part of this change list. If an unsupported configuration is found MDL will for now just render the top BSDF as if it was opaque. **2. Propagation of BSDF parameters** Setting of BSDF parameters for thin-film was previously done by direct assignment from the top thin-film layer to the base BSDF layer it applies to. Hence layering of thin-film could only be done directly on top of an atomic BSDF node. In this change list we instead propagate these closure parameters through the BSDF network. For example, if the thin-film is applied to a BSDF mix node the parameters will propagate to both BSDF components upstream. If it's applied to a BSDF layer node it will be applied to only the top component upstream. Hence it's possible to apply thin-film to both atomic BSDFs, mixtures and layer stacks. This can be extended to include other layering parameters in the future. This change also applies mainly to GLSL and OSL. For MDL there is an explicit node handling thin-film so it does not apply there. **Other changes** - Some improvements towards supporting VDF's with the BSDF-over-VDF version of the layer operator. - Cleanup of legacy elements in test suite documents. - Adding missing class export directives. * Fix the incorrect package version in CMake file (#749) * Optimizations to GLSL shading (#748) - Move filtered importance sampling from world space to tangent space. - Move NDF and PDF computations from world space to tangent space. - Pass alpha arguments as vec2, allowing additional SIMD optimizations to be stated explicitly. * FreeBSD support. (#734) * Add support for rough nodedef matches This changelist adds support for rough nodedef matches, where a node contains additional inputs not found in its nodedef declaration. This matching approach has been applied to shader nodes in code generation, allowing a roughly-matching shader node to render with warnings, rather than completely failing to render. * Add include statements for PATH_MAX on linux and FreeBSD. (#733) * Update changelog for recent work * Update writelooks.py for 1.38.3 This changelist updates Python script 'writelooks.py' for the 1.38.3 API. Moving forward, we should consider more modern replacements for the Materials/Examples/Syntax folder and its associated Python scripts, but for now we're preserving them and updating this script to the latest API. * Merge of additional fixes after BSDF refactor (#758) * Fix issue with getting implementations for nodedefs with inheritance. * Fix regression with vertex data prefix. * Build matrix improvements - Add coverage for Visual Studio 2022 - Add coverage for shared libraries and Python 2 on Linux Clang. - Add render testing for Linux Clang. - Simplify shader validations tests for readability. * Refactor TextureBaker and add support for baking material subsets (#745) * Removed `createBakeDocuments`. * Created function `bakeMaterialToDoc` (contains functionality nested in the loop of `createBakeDocuments` which iterated through each `renderablePath`). * Moved public facing `bakeMaterial` to protected `generateBakedDocumentFromShader`. * FreeBSD compatibility patch (#761) * Install cmake files into lib/cmake, not just cmake. (#762) cmake files are commonly installed into lib/cmake. * Update PyBind11 to version 2.7.1 (#760) * Add Python 3.9 to build matrix This changelist adds Python 3.9 to the build matrix in GitHub Actions, leveraging support for this version of Python in PyBind11 2.7.1. * Add material discovery utilities (#743) * `NodeGraph::getMaterialOutputs` : return any outputs connected to an graph material node * `Node::getMaterialOutputs` : return any outputs of type material. * `MaterialAssign::getMaterialOutputs` : return any outputs on assigned nodegraphs which have outputs of type material. Uses the Nodegraph method. * `Document::getMaterialOutputs` : return any outputs on nodegraphs which have outputs of type material. Uses the Nodegraph method. Note that implementation nodegraphs are ignored. * Fix viewer performance for multi-UDIM assets (#765) This changelist fixes a regression in the performance of the MaterialX viewer for multi-UDIM assets, which was caused by unbinding geometries between the rendering of each mesh partition. Additionally, it adds the helper method GeometryHandler::findParentMesh, which is used to clarify mesh and shader binding logic in Viewer::renderFrame. * Streamline property binding in GlslProgram - Merge dual paths for property binding in GlslProgram, removing the older bindInputs/unbindInputs path. - Clarify the implementation of GlslProgram::unbindGeometry. - Remove unneeded geometry unbinding steps in the viewer. * Deterministic codegen (#767) This change list adds some changes to make codegen deterministic, always producing the same code from the same input data. * Change connection storage on ShaderOutput from set to vector to make connection ordering deterministic. * Make ShaderGraph topological sort order independent of std::unorder_map implementation. * Add test for deterministic codegen. * Improvements to mesh names - For improved readability and compactness, use the term 'name' for mesh/partition name strings in MaterialXRender. - Track the source names of partitions when they are merged or split. - Add handling for source names in viewer mesh assignment. * Add Camera class to MaterialXRender This changelist adds an initial Camera class to the MaterialXRender library, merging the original ViewHandler class with the MaterialXView camera, and adding viewport projection methods previously provided by NanoGUI. * Update for Vulkan compliance in GLSL codegen (#769) - Fix usage of keyword "sampler" in code - Update `generateShader` script to support Vulkan code and uniform layout code generation. - Add test to CI using `glslValidaitor` with Vulkan option. * Unify GLSL light handling - Unify light handling between MaterialXRenderGlsl and MaterialXView, reducing code duplication. - Align naming conventions for light IDs in GLSL. - Add input arguments to GlslProgram::bindTimeAndFrame, allowing applications to override its default values. * Support nodedef/nodegraph associations via implementation elements (#754) - Add ability to find a nodedef / nodegraph definition via an implementation. - Update "standard surface" to allow for 2 versions to be specified in the library. * Improvements to document versioning - Add an upgradeVersion option to XmlReadOptions, allowing clients to disable version upgrading in utilities. - Add warnings for unsupported and future document versions in validation. * Update changelog for recent work * Update CMake config file (#780) - Stores shared library state for downstream Windows clients - Adds utility paths found in legacy FindMaterialX.cmake - Fixes config file location to follow CMake guidelines Tested by building USD on Windows using generated config files of a MaterialX built with shared libraries. * Fix output type of blackbody node This changelist fixes the output type of the blackbody node, aligning it with the specification. * Re-expose virtual callback to emit light functions (#784) This callback was removed in PR #747. We restore it so USD can keep using it in their codegen. * OSL image structure support (#782) - Modify code generation to query and pass on colorspace information to top level uniforms. - Change OSL filename syntax to be a structure. Current members include `filename` and `colorspace` but more can be added (such as for udim information which is currently additional arguments) - Update OSL color3 / color4 image implementations to accept structure as input. Use string tokens to output arguments to texture() calls. - Modify Syntax / TypeSyntax interface to accept string value extraction based on ShaderPort (which has typed inputs/outputs). - Modify OSL shader code generation to emit structure as input argument. - Modify GLSL introspection to query for colorspace information. Only used for reflection currently. - Add new GenOption options to indicate whether to emit transforms if a color transform is found. Default is set to true. * Custom namespace and library naming support (#785) * Align formatting for standard_surface * Apply Clang formatting to MaterialXCore * Give access to class derived from SurfaceNodeGLSL (#789) One such class is the SurfaceNodeMaya as used by MayaUSD. * Update changelog for recent work * Finalize changelog for v1.38.3 * Clarify changelog text * Update development build to 1.38.4 * Update main page for ASWF transition - Remove Lucasfilm renders from the main page and viewer documentation, in preparation for the transition of MaterialX to the Academy Software Foundation. - Update image alignment on the main page and viewer documentation. * Improved handling for empty materials - Add a null check to getShaderNodes, handling the case where a material node has no implementation. - Add a check for empty material nodes in Node::validate. * Improved document validation - Add validation for node interfaces when standard libraries are present in a document. - Fix errors caught by the new validation logic. - Remove the older example Looks.mtlx, which no longer passes validation or reflects current usage. * Improvements to Windows build testing - Create a separate step for vcpkg installation on Windows. - Add an optional step for OpenImageIO installation on Windows. - Simplify runtime path handling on Windows. * Improvements to build matrix - Add Python 3.9 builds for all platforms. - Update compiler versions on MacOS. - Suppress warnings in Windows setup. * Add reference GLSL implementation for Worley Noise nodes. (#776) This adds the reference implementation to `lib/mx_noise.glsl` and new `.glsl` functions that call into the noise library. `stdlib_genglsl_impl.mtlx` was modified to call the new functions. This is the implementation as discussed on the ASWF slack. * Improvements to standard libraries - Remove unneeded guards in GLSL albedo table lookups. - Improve robustness of the GLSL implementation of normalmap. - Fix the default output of heighttonormal. * Add include guards for ESSL * Web Update Part 3 : Javascript Wrappers (#709) - Adds JS wrappers which cover MaterialXCore, MaterialXFormat, and sufficient wrappers for OpenES code generation. - Uses Emscripten for wrapper generation as part of CI. - Unit tests include basic non-browser tests + non-interactive browser test. - JS MaterialXView sample view uses generation to feed into Three.js for interactive browser. Tests are limited to default sample Materials for now, and can be run using a local server. - The JS MaterialXView example also updates a `gh-pages` branch as part of CI. A public github page can be created allowing for a supported browser to execute the run the viewer found in this branch. By default the published page can be: `materialx.github.io` with the folder `MaterialX` containing the viewer contents. * Remove Draco dependency for speed * Enable single-commit deployment * Fix shader compilation in albedo table generation (#807) The albedo table shader fails to compile because DIRECTIONAL_ALBEDO_METHOD is not defined. DIRECTIONAL_ALBEDO_METHOD gets defined if and only if lighting nodes are found (see GlslShaderGenerator::requiresLighting) * Ensure CMake configuration relocatability (#805) - All install paths must be relative for CMake to generate a relocatable config file. This means removing all `CMAKE_INSTALL_PREFIX` components that point to an absolute path. - Patch to handle non-python MaterialX config generation. * Port Worley noise GLSL implementation to MDL (#809) Straightforward port from GLSL to MDL shader code. * Fix MDL sheen BSDF (#786) Similar to the other BSDFs, mx_sheen_bsdf also needs to pass the volume properties to the next layer. * Initial implementation of Worley noise for OSL (#810) Adds an initial implementation of Worley noise for OSL. The hash is not yet identical to the one used by the GLSL and MDL implementations (an unsigned int right shift operator is missing in OSL). As discussed we will ignore this for now and we will refine this later to get identical results. * Improved OSL render testing (#811) - Clarify the names of OSL test options, giving them a consistent MATERIALX_OSL prefix. - Move the list of render test paths from code to data, adding a "renderTestPaths" option to options.mtlx. - Manually convert relative paths in OSL render tests, working around an issue in testrender on Windows. - Add support for launching MaterialXTest directly from Visual Studio. - Fix typos in the transparency regression check for MaterialXGenShader. * Add PyElement.getDescendant (#813) * Ensure libMaterialXRenderHw has a dependency on libXt (#753) After linking a program against a MaterialX build I made recently on Linux, I got this error on execution: Error: /blah/libMaterialXRenderHw.so: undefined symbol: topLevelShellWidgetClass On inspection, the problem was that `libMaterialXRenderHw.so` wasn't declaring a dependency on `libXt.so`. When I inspected the CMake source, I found this was because RenderHw wasn't doing a `find_package(X11)` - so that even though it calls `target_link_libraries(${X11_Xt_LIB})`, it does nothing because `${X11_Xt_LIB}` hasn't been populated yet. * Improvements to render test parity (#814) This changelist implements a number of improvements to the parity of render tests between GLSL and OSL, including the following: - Render with a unit sphere in both GLSL and OSL, adjusting the zoom in OSL to compensate for framing differences. - Increase the environment map sample count in GLSL. - Increase the rays per pixel for lit surfaces in OSL. - Increase the tolerance for error messages in testrender. * Fix up HTML generator for tests. (#815) Fixes the following: - Adding to source destination lists incorrectly, producing source on one row and destination on another. - Cleaned up to use source to determine destination file name by replacing language to avoid name mismatches per row. - If exists as source file, then append destination file. e.g. if foo.glsl.png found then foo.osl.png is added. The second file is not checked until generation time. - Fix to allow only one language to be shown (again) if both destination and source languages are the same. * Security updates for JS dependencies (#1352) (#816) * Remap texcoord indices in MaterialXView - Remap unsupported texcoord indices in MaterialXView, allowing materials with multiple texcoords to be roughly visualized. - Add exception handling to renderFrame in MaterialXView. * Improvements to reference OSL shaders - Remove the original, hardcoded set of reference OSL shaders, which no longer reflect the current specification. - Improve the reference OSL shader generation and validation in GenReference.cpp. - Upload reference OSL shaders as an artifact in GitHub Actions. - Move shared OSL includes to a dedicated folder (libraries/stdlib/genosl/include). * Fix to OBJ geometry: sphere and plane (#819) - Align sphere geometry and UV origin border line with z-axis. - Orient plane geometry so UVs are not flipped in V. - Remove additional extra UV transform which was used to try and align UVs properly. * Upgrade to latest NanoGUI This changelist upgrades MaterialXView to the latest version of NanoGUI, providing initial access to its support for Metal and WASM code generation. See https://github.com/mitsuba-renderer/nanogui for more details on the NanoGUI framework. * Update OSL to latest directional albedo This changelist updates OSL code generation to the latest analytic approximation for directional albedo, improving the parity of BSDF renders between OSL and other languages. For simplicity, the two alternative methods for computing directional albedo in OSL have been removed, since they achieved nearly identical results in a less efficient way. * Refinements to GGX directional albedo (#826) This changelist refines the constants for the analytic approximation to GGX directional albedo in MaterialX. The latest constants have been fitted to a Monte Carlo simulation with 16K samples per pixel, and reduce the average error from 0.0022 to 0.0012. Additional improvements: - Add an "Albedo Method" combo box to MaterialXView, with its set of options being "Analytic", "Table", and "MC". - Update the resource paths in MaterialXView to match the latest CMake build process. * Add V-flip option for geometry loaders (#825) - Allows for customization on load allowing for tangent space to be computed on load - Used for GLSL render unit testing when the specified geometry is the "stock" sphere or plane. - Turn off texture flip as a consequence of flipping texture coordinates. - Also simplified testing logic to either use the geometry file if specified or default to the stock sphere otherwise. * Default to analytic albedo in MaterialXView - Default to using analytic directional albedo in MaterialXView, only generating a directional albedo table when requested by the user. - Clamp the AB term in analytic directional albedo, providing a small improvement in accuracy (reduces average error from 0.0012 to 0.0011, and improves behavior at parameter boundaries). * Add new signatures for cellnoise (#829) Add new signatures for cellnoise to support higher dimensions of seed, but also to generate Vec3 results. These methods are consistent with the OSL implementation of cellnoise. Change Worley noise to use cellnoise to pick the offsets in the cell (rather than mx_hash_vec3()). This is a more generic form that only uses public API calls in OSL so it can be implemented without any changes to the core OSL library. * Clarify usage of alpha and roughness This changelist clarifies the usage of the terms alpha and roughness in the PBR libraries for GLSL and OSL, using the term 'alpha' to mean the square of artist-facing roughness in the context of specular BSDFs. In the future, we should consider modifying the interfaces of specular BSDF nodes such as <dielectric_bsdf> and <conductor_bsdf> to follow this convention as well, since their "roughness" inputs actually represent alpha. Additional changes: - Align handling of input alpha between GLSL and OSL. - Remove unused helper functions in the PBR library for OSL. * Refinements to GGX directional albedo (#831) - Improve the precision of the computation in mx_ggx_dir_albedo_monte_carlo, moving the global component of the geometric term outside of the sample loop. - Rebuild the constants in mx_ggx_dir_albedo_analytic using MATLAB. * OSL Reference Generation Updates (#833) Minor fixes for the following: - Add in ignore list to skip definitions which have no implementations. - Fix include search path for OSL renderer. Syntax was incorrect, and did not handle multiple paths. - Fix to add in proper search path for inlines if not running compilation test. - Fix to avoid emitting absolute paths for includes and instead handle this via the compilation time check by adding in include search paths. - Add in failure condition for any unexpected generation. Could fail without detection before. * Add OSL node name metadata (#834) Add in metadata at the shader level which outputs the node category and qualified name. * Adoption of new Worley noise implementation for OSL (#836) Adopting the new Worley noise implementation written by @code-monkey. The results are now identical between GLSL and OSL, and there is no longer any code duplication since the implementation uses OSL's built-in cellnoise functions. * Make fractal3d node consistent between GLSL and OSL (#838) Improve GLSL implementation to make fractal3d results consistent with OSL. * Improvements to OSL tangent frame (#844) - Generate normalized tangent and bitangent vectors in vanilla OSL. - Generate custom tangent and bitangent vectors for the parametric sphere in testrender, aligning them with Lengyel/Mikkelsen conventions for a polygonal sphere. - Add a reference quality option for render tests. * GLSL mx_fresnel_conductor now uses physically correct function (#843) The previous implementation was an optimization, and gave incorrect results when "k" approached zero. This change improves alignment with offline renderers. * Port noise improvements to MDL (#842) This changelist ports the recent improvements to noise in GLSL/OSL to MDL. Results should now be consistent between all three languages. * Material test suite cleanup - Remove value attributes that are overridden by node connections. - Remove explicit assignments of default values. - Remove legacy xpos and ypos attributes with screen-space coordinates. * Improvements to convolution render tests This changelist improves the render test suite for convolution nodes, clarifying the extent of their current implementation in MaterialX code generation. Additionally, it restores the originally-intended value for blur filter size, which was lost in the upgrade from 1.37 to 1.38. * Update to standard Apache License 2.0 This changelist updates the MaterialX project to a standard Apache License 2.0, in preparation for its transition to the Academy Software Foundation. * Make addInputFromNodeDef consider inheritance (#837) Based on discussion with @niklasharrysson on Slack Node::addInputFromNodeDef should consider inherited inputs. * Clarify Fresnel logic in GLSL - Add constants for Fresnel model indices. - Separate FresnelData parameters for physical and generalized Schlick models. - Move shared initializations to an mx_init_fresnel_data function. * Fix typo in MDL thin_surface (#855) * Update mxdoc node definition script (#851) - Add support for `html` output as an option in addition to `Markdown` - Add in additional attributes not currently output per attribute: `doc`, `uiname` - Add in `output` and `token` port attribute support - Add in `version`, `isdefaultversion`, and `inherit`. For inheritance, allow to emit inherited attributes as an option. - For testing: add in html output for python tests as part of CI actions. * Update contribution guidelines for ASWF This changelist updates the contribution guidelines for the MaterialX project within the Academy Software Foundation. * Fix for code generation from multioutput graphs (#853) * Optimize GitHub Actions testing - Disable shadow maps in virtual framebuffer renders. - Remove duplication of render tests between GCC and Clang. Supporting changes: - Add a 'shadowMap' command-line option to MaterialXView. - Align render settings conventions between MaterialXRender and MaterialXView. * Shader generation token resolution (#845) Update to make code generation (or any resolver call) correctly perform token substitution. Can handle token elements within a node, a nodegraph and at the Document level. Those tokens which are closest in level to the input are considered higher priority than those at higher levels. * Update main page links for ASWF This changelist updates links on the main page, reflecting the new location of the MaterialX project within the ASWF organization on GitHub. * GLTF geometry loader using cgltf library. (#846) GLTF geometry-only loader * Uses cgltf for loading * Converts transform instancing into instances of geometry as this is not supported by the Mesh geometry classes and the viewer. * Auto generates uvs, normals and tangents if not found. * Does not handle materials or texture dependencies * The viewer logic has been updated to handle multiple meshes. * An unlit surface shader constructor node (#860) Implementation of the "unlit" surface shader, as proposed in issue #839. This change list adds the definitions and implementations for GLSL, OSL and MDL. * Fix range node graphs This changelist fixes the handling of clamp functionality in the graph definitions of the range node, and updates related test materials for clarity. * Remove test coverage for color2 type This changelist removes legacy test coverage for the color2 data type, which is no longer present in MaterialX 1.38. * Update changelog for recent work * Add glTF PBR (#861) This PR adds a node definition and implementation of the glTF PBR material with the following extensions: * KHR_materials_transmission * KHR_materials_specular * KHR_materials_ior * KHR_materials_sheen * KHR_materials_clearcoat * KHR_materials_volume * Remove legacy syntax examples This changelist removes the legacy material examples in the Materials/Examples/Syntax folder. These examples were useful references in earlier versions of MaterialX, but they have since been superseded by renderable examples in the Materials/Examples and Materials/TestSuite folders. * Remove hardcoded search path string This changelist removes a hardcoded inclusion of the "libraries" string in calls to GenContext::registerSourceCodeSearchPath, giving control back to include directives to specify which top-level folder is intended. As a result, applications with custom code generators will need to remove this string from their own calls to GenContext::registerSourceCodeSearchPath when they upgrade to MaterialX 1.38.4. Supporting changes include: - Give precedence to user-supplied libraries over the standard libraries in MaterialXView, generateshader.py, and translateshader.py. - Minor fixes to texture baking in MaterialXView. * Upgrade light nodes This changelist upgrades all light nodes used in hardware shading to the 1.38 standard, refining their documentation for clarity. * Command-line viewer improvements This changelist makes the following improvements to command-line usage of MaterialXView: - Add support for filename arguments that are relative to the current working directory. - Compile optional shaders on demand, providing a small performance improvement for command-line renders. * Update changelog for recent work * Update PyBind11 to version 2.9.0 * Fix "show all inputs" option in MaterialXView (#869) - At load time node definition inputs are added to each node. - This allows shader gen to take these into consideration. - At UI building time the inputs will exist for usage. * Initial third-party license file This changelist moves third-party licenses from their original LICENSE.txt to a dedicated THIRD-PARTY.md file, following the pattern of other projects within the ASWF. Also, add LICENSE and THIRD-PARTY.md to the installation process, making these files part of MaterialX releases. * Static analysis fixes - Remove const keyword from Shader::setSourceCode. - Assign explicitly-defaulted constructor to the ShCoeffs class. - Use consistent letter case for GLFramebuffer and related classes. - Clarify logic in GLTextureHandler::mapFilterTypeToGL and Viewer::initCamera. * Improvements to testing and TextureBaker (#883) Testing updates: - Create data model to define wedge and baking testing parameters in options.mtlx - Add test case for material nodegraph translation TextureBaker updates: - Add a uv min/max settings and update GlslRenderer::renderTextureSpace to set the uv range for the baking quad. - Enable hashing for baked image names to avoid long path issues. * Add glTF BoomBox example (#870) - Add in BoomBox example from Ed Mackey. Minor name change to shader and material so it's easier to read results. - Add in `GltfPbr` directory for generation tests and render tests. - As part of this fixed OSL tests to work if any new test file uses relative resource pathing by pre-processing these paths beforehand. * Minor updates / corrections to Javascript documentation. (#893) - Fix up some incorrect / outdated information - Update with info on sample build scripts * Additional improvements to surface_unlit - Assign a unique name to the new node, in order to avoid name collisions in applications with dynamic node typing (i.e. where node types are inferred from connections). - Set the default value of the emission scalar input to 1. * Improvements to geometric constants - Add Python bindings for all geometric constants (e.g. UDIM_TOKEN, UV_TILE_TOKEN). - Clarify the name of the UDIM_SET_PROPERTY constant. * Simplify MaterialXCore includes - Remove duplicate header includes in MaterialXCore. - Include Generated.h before defining platform macros in Library.h. * Move Quaternion class to MaterialXRender This changelist moves the Quaternion class from MaterialXCore to MaterialXRender, clarifying its role as a camera/render helper class rather than a core MaterialX data type. * JavaScript viewer update (#895) - Add USD and glTF as loadable materials. - Add in geometry switcher to select glTF files to load. - Fix texture flipping. - Fix when default url options not set. - Update camera to more closely match desktop viewer. - For boombox example add in images and image path mapping. Search pathing has not been added to viewer so adding to manual mapping. - Fixed up geometric stream loading so there is fallback geometry if the load fails, and if there are no uvs or normals they are generated. This prevents tangent generation from failing if either of those does not exist and hence failing on a series of GL errors. - Add some very basic parameter control. * Finalize changelog for v1.38.4 * Update development build to 1.38.5 * Update main page links This changelist updates links to pre-built binaries on the main page. * Static analysis fixes - Fix mismatched namespace macros. - Fix const correctness in BIND_VECTOR_SUBCLASS. - Remove unused variables, classes, and includes. - Add unit test for readFromXmlBuffer. * Update TestSuite to align with main * Pass strings by const reference This changelist updates a handful of common methods to pass strings by const reference rather than by value. * Initial static analysis in GitHub Actions This changelist adds an initial static analysis test to GitHub Actions, running cppcheck on the C++ codebase for each commit to the repository. Also, two related improvements: - Clarify the handling of the unique_ptr in TypeDesc::registerType. - Clarify the order of reads and writes to a union in Half::toFloat16. * Improvements to MaterialXView - Improve OpenGL state handling, addressing an environment clipping error caused by changes in the sphere geometry. - Simplify the writing of shader source to disk, reusing viewport shaders when they're already present. * Build fix * Fix UI min/max range for subsurface_anisotropy in Standard Surface (#911) * Add emissive strength to glTF PBR (#910) * Refactor Web MaterialXView (#909) * Create Viewer, Editor, Material and Scene classes to organize functionality * Change material and geometry changes to not reload the entire page causing everything to be re-initialized. Instead perform incremental updates. * Small fix to get any UI names if looking up an interface input * Use qualified names in getDownstreamPorts (#890) This changelist fixes the issue with flattenSubgraphs described in #865. * Fix environment preview for viewer (#913) The environment material used for 3d preview was not being recompiled when changing the environment. Hence the scene was rendering using the new environment, but the preview was not. * Improvements to support locale and units (#892) - Add utilities UnitConverterRegistry::convertToUnit and MaterialX::joinStrings. - Use C Locale for string stream operations (https://github.com/autodesk-forks/MaterialX/issues/1183). - Add tests for unit and locale content. * Improved color consistency of backgrounds - Align screen background colors between MaterialXView, MaterialXRenderGlsl, and MaterialXRenderOsl. - Add helper methods to transform colors between linear RGB and the sRGB encoding. * IMP_UsdPrimvarReader reader fixes (#915) As per discussions on MaterialX slack channel, this implements... - the "fallback" parameter in IMP_UsdPrimvarReader - also makes the default parameter in ND_geompropvalue_integer non-uniform * Update resources to remove adsk_contrib changes * Add Export.mtlx for Runtime * Improvements to locale unit tests - Restore the original locale after unit tests are complete, so that render tests are unaffected by the change. - Simplify locale unit tests, removing steps that aren't required. * TempFix: Disable SUPPORT_ARNOLD_CONTEXT_STRING * Build fix * .js buildfix * Fix sample sphere geometry (#917) An interior test plane was left inside the sphere geometry. Removing it as it affects transparent objects as well as environment preview in MaterialXView. * Restoring two missing test files * Initial refraction approximation in GLSL (#918) This changelist introduces a rough approximation of refraction in GLSL, allowing transmissive materials such as glass to respond visually to changes in specular_IOR, specular_roughness, and transmission_color. Because this initial approximation is limited to a single render pass, only the environment radiance map is currently visible in refractions, and opaque objects behind transmissive surfaces are not yet visible. * Update generator search path in JavaScript This changelist updates the generator search path used in MaterialX JavaScript, aligning it with other generators in the MaterialX codebase. * Simplify Python bindings for ShaderGenerator This changelist simplifies Python bindings for the base ShaderGenerator class, making it concrete rather than abstract, and removing the PyShaderGenerator trampoline class. Co-authored-by: Jonathan Stone <jstone@lucasfilm.com> Co-authored-by: Bernard Kwok <Bernard.Kwok@autodesk.com> Co-authored-by: marsupial <marsupial@users.noreply.github.com> Co-authored-by: Mark Tucker <mtucker@sidefx.com> Co-authored-by: Niklas Harrysson <niklas.harrysson@gmail.com> Co-authored-by: dlarsson-adobe <68669897+dlarsson-adobe@users.noreply.github.com> Co-authored-by: K. S. Ernest (iFire) Lee <fire@users.noreply.github.com> Co-authored-by: kngo-lucasfilm <86328732+kngo-lucasfilm@users.noreply.github.com> Co-authored-by: Brian Sharpe <brisharpe@yahoo.com> Co-authored-by: Madeleine Yip <52723401+mjyip-lucasfilm@users.noreply.github.com> Co-authored-by: Bernard Kwok <kwokcb@gmail.com> Co-authored-by: yuri@FreeBSD <yurivict@users.noreply.github.com> Co-authored-by: Mark Elendt <mark@sidefx.com> Co-authored-by: Tobias Häußler <mail@tobiashaeussler.com> Co-authored-by: Paul Molodowitch <elrond79@gmail.com> Co-authored-by: Rasmus Bonnedal <rasmus.bonnedal@gmail.com> Co-authored-by: ZapAndersson <102356572+ZapAndersson@users.noreply.github.com> Co-authored-by: Jerry Gamache <jerry.gamache@autodesk.com>
Fix #615
Float slider goes from UISoftMin to UISoftMax when available
Float textbox now clamps between UIMin and UIMax and shows a spinner control when UIStep is present.
Int textbox is now editable, clamps between UIMin and UIMax, and uses UIStep with the spinner control