AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX

Add support for disabled nodes in shader generation

Open
#1,687 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.3k
Forks
451
Avg merge
6d 6h
Merged PRs (30d)
5

Description

## Issue

Currently the [specification](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/Specification/MaterialX.Specification.md#nodedef-output-elements) 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 `` node which is a pass-through if connected ?

Related to this is to add in proper routing for `` and interfaces routing through `` nodes as noted in [this issue](https://github.com/AcademySoftwareFoundation/MaterialX/issues/1462).

Contributor guide

Open the contributing guide

Research direction

Start with the NodeDef Output elements section in documents/Specification/MaterialX.Specification.md and review the existing shader-generation path for disabled nodes. Determine the intended behavior for defaultinput, default, and unspecified defaults, including the related image-routing scope. Done means disabled nodes consistently use the specified pass-through or constant output behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.