MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Add support for disabled nodes in shader generation

Open kwokcb opened this issue 5 months ago • 1 comments

Issue

Currently the specification notes that outputs can have default inputs / values to handle if a node is disabled / pass-through.

Attributes for NodeDef Output elements: name (string, required): the name of the output. For nodes with a single output, the name "out" is preferred. type (string, required): the MaterialX type of the output. defaultinput (string, optional): the name of an element within the , which must be the same type as type, that will be passed through unmodified by applications that don’t have an implementation for this node. default (same type as type, optional): a constant value which will be output by applications that don’t have an implementation for this node, or if a defaultinput input is specified but that input is not connected.

This is currently not supported by shader generation.

Proposal

Update shader generation to recognize if a node has been disabled and use the default input or output on a node.

  • An issue is what to do if these defaults are not specified. E.g. should it be assigned to be 0 for scalars, false for booleans, unit matrix for matrices, empty string for strings etc ?

  • Assume that the logic is similar to that of a <dot> node which is a pass-through if connected ?

Related to this is to add in proper routing for <image> and interfaces routing through <image> nodes as noted in this issue.

kwokcb avatar Feb 02 '24 12:02 kwokcb