Skip to content

Add HW generation support for compound material nodes#2829

Open
jstone-lucasfilm wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
jstone-lucasfilm:dev_lama_surface
Open

Add HW generation support for compound material nodes#2829
jstone-lucasfilm wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
jstone-lucasfilm:dev_lama_surface

Conversation

@jstone-lucasfilm
Copy link
Member

@jstone-lucasfilm jstone-lucasfilm commented Mar 17, 2026

This changelist adds hardware shader generation support for compound material nodes such as LamaSurface, which are defined as node graphs with material-type outputs. The following specific changes are included:

  • Add an HwMaterialCompoundNode class that extends HwSurfaceNode for nodegraphs with material-type outputs, discovering BSDF, EDF, and opacity input name mappings by analyzing the nodegraph's internal surface node connections.
  • Refactor HwSurfaceNode to resolve input names through virtual methods rather than hardcoded strings, and add null-safety for inputs that may not be present on compound material nodes.
  • Fix the fallback condition in getShaderNodes to check whether shader nodes were found, rather than whether the material node has inputs.
  • Fix isTransparentSurface to identify material nodes by output type rather than node category, so that compound material nodes are handled correctly.

Fixes #1902 and #2811.

This changelist adds hardware shader generation support for compound material nodes such as LamaSurface, which are defined as node graphs with material-type outputs.  The following specific changes are included:

- Add an `HwMaterialCompoundNode` class that extends `HwSurfaceNode` for nodegraphs with material-type outputs, discovering BSDF, EDF, and opacity input name mappings by analyzing the nodegraph's internal surface node connections.
- Refactor `HwSurfaceNode` to resolve input names through virtual methods rather than hardcoded strings, and add null-safety for inputs that may not be present on compound material nodes.
- Fix the fallback condition in `getShaderNodes` to check whether shader nodes were found, rather than whether the material node has inputs.
- Fix `isTransparentSurface` to identify material nodes by output type rather than node category, so that compound material nodes are handled correctly.

Fixes AcademySoftwareFoundation#1902 and AcademySoftwareFoundation#2801.
Instead of looping over nodes to find the first surface node, use graph traversal from each output, which should be more robust in complex graphs.
@jstone-lucasfilm
Copy link
Member Author

To provide a visual sense of the results, here's a MaterialX graph of Lama nodes in the Graph Editor, using a LamaSurface node for the final render:

LamaGraphExample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow support for custom nodes that return surfacematerial data

1 participant