AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX
Proposal : Improvements to double sided surface shading.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 464
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 11
Description
Introduction
This document summarizes a couple of recent conversations surrounding how shading the front and surface of an object might be improved in MaterialX. It’s broken down into a number of separate proposals. One of the benefits of this proposal is that it would allow artists to construct materials with different values or surface shaders on each side of a surface, and use that MaterialX material in USD without requiring changes to USD. To be clear, this proposal does not preclude USD adding support for the backsurfaceshader terminal in the <surfacematerial>, but it would eliminate a potential complication regarding USD supporting MaterialX 1.39 early next year.
Proposal : <frontface> Node
This node accepts no input, returns true if the front surface is being shaded, and false for the back surface. This node will allow the MaterialX graph to make decisions based on which side of the surface is being shaded.
<nodedef name=”ND_frontface_boolean” node=”frontface” type=”boolean”>
<output name=”out” type=”boolean”
</nodedef>
Questions:
- Is it also useful to have an
integerversion of this node that returns0and1? This would make it easier to use as an input to<switch>.
Proposal : <twosides>
This node allows two different input values to be switched between, based on which side of the surface is being shaded. For instance, this node could be used to swap the color of a surface between the front and back sides of a surface.
<nodedef name=”ND_twosides_float` node=”twosides” type=”color3”>
<input name=”front” type=”float” value=”0”/>
<input name=”back” type=”float” value=”0”/>
<output name=”out” type=”float”/>
</nodedef>
Its noted that this node could be implemented as a nodegraph implementation if the proposal for adding the <frontface> node above is accepted.
It is proposed that this node would have node definitions for the following types.
floatintegercolor3color4vector2vector3vector4matrix33matrix44surfaceshader
This last type is an important one. It would allow us to address the current conversation surrounding having different shaders on each side of a surface. Allowing two surfaces to be combined into a single port, and then connected to a downstream <surfacematerial> node, this is the critical component to gain the advantage of easier MaterialX 1.39 adoption in USD early next year.
<UsdPreviewSurface name=”frontMtl” type=”surfaceshader”>
<input name=”diffuseColor” type=”color3” value=”1, 0, 0”/>
<input name=”metallic” type=”float” value=”1”/>
</UsdPreviewSurface>
<UsdPreviewSurface name=”backMtl” type=”surfaceshader”>
<input name=”diffuseColor” type=”color3” value=”0, 0, 1”/>
<input name=”metallic” type=”float” value=”0”/>
</UsdPreviewSurface>
<twosides name=”twosides” type=”surfaceshader”>
<input name=”front” type=”surfaceshader” nodename=”frontMtl”/>
<input name=”back” type=”surfaceshader” nodename=”backMtl”/>
</twosides>
<surfacematerial name=”MyMtl” >
<input name=”surfaceshader” type=”surfaceshader” nodename=”twosides”/>
</surfacematerial>
This proposal is intentionally not taking any stance around considerations for uniform data, to keep the focus on double sided aspect of this proposal. We would expect this twosides node to follow any future introduced conventions to accommodate uniform data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The proposal names the frontface and twosides nodes but no files, tests, or entry points. Start by reviewing the unresolved design questions and the listed node types; done means an agreed, implementable proposal for double-sided surface shading.
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
- 25/100