Skip to content
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

Web Viewer: When loading file that contains both surfacematerial and a nodegraph with single output, only one material is displayed #1633

Closed
hybridherbst opened this issue Jan 4, 2024 · 3 comments · Fixed by #1644

Comments

@hybridherbst
Copy link
Contributor

Relevant Slack discussion: https://academysoftwarefdn.slack.com/archives/C0230LWBE2X/p1704323996349749

The attached file contains two materials, one implicit (single-output nodegraph) and one explicit (named surfacematerial).
According to the discussion, this is valid.
two-materials.mtlx.zip

I think it would be good if the viewer

  • showed all materials in a file (it seems to already do this for the chess_set, just not here)
  • allows choosing which material to display on the default shaderball (so in this case I could choose between the two in the file)
@kwokcb
Copy link
Contributor

kwokcb commented Jan 4, 2024

Some "rambling" thoughts on this :). Whatever is done it would be good to have consistent workflows between all sample viewers / editors if plausible.

The simple logic currently on load is

  1. to use at material assignments if present <materialassign>. Thus the chess set and, the "look" examples and the boombox have shaders assigned to the appropriate glTF geometry node.
  2. otherwise take the first shader and assign it to all geometry.

The geometry is whatever geometry is currently loaded though the default is a shaderball.

The current state for desktop is:

  • A. Viewer: does 1,2 but allows for a current geometry to be set and a material selected to use against that geometry. A bit clumsy with any real scene viewer or interactive assignment. Assignments are not saved though maybe they should be?
  • B. The Node Editor will take the first renderable and use it against the current geometry on load. Material assignments are not considered. Node selection determines the closest downstream "renderable" and uses that. Currently a renderable is either a material or surfaceshader node. This can be extended as "renderables" also include outputs which are scalar (float, vec2/3/4, color3/4).

Thus:

  • I. There isn't really a "show all materials" option and not sure what that implies.
  • II. There isn't really a consistent way to choose what renderable to display.

I think the choice of how to add this in depends on the intent of the viewer / editor. For:

  • I. This could be a preview "swatch" per renderable, or a separate geometry per renderable (instance the shadeball). This could be be consistently done for all editors/viewers.
  • II. This could be a assignment mechanism (someone like a geometry selection + renderable selection then assignment workflow). Or this could be done by "solo"ing the renderable (choose a renderable to show on all geometry while "solo"ing and then the current assignments when not "solo"ing. This would work for the node editor as well.

@hybridherbst
Copy link
Contributor Author

To clarify, with "show all materials" I mean that they and their properties should be listed in the GUI, not "shown on an object in the scene".

E.g. here's chess_set.mtlx:
image

I would like to be able to click a little button next to each of these names to adjust what is displayed on the ShaderBall. If the model has a stronger opinion (materialassign being used) then that should always win.

For the file I attached, that would mean

  • there's two materials listed in the properties section
  • the lit one has precedence and is active by default on the ShaderBall
  • I could click a little button next to the name of the second material to display that on the ShaderBall

Does that make more sense?

@kwokcb
Copy link
Contributor

kwokcb commented Jan 4, 2024

Yes. Thanks for the clarification.

The button click option sounds equivalent to what I called "solo"ing.

I think it should be allowable to override material assignments otherwise if you have all geometry assigned and another material in the same file you can never view it -- but this could be an option.

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 a pull request may close this issue.

2 participants