This issue has been logged for discussion purposes
Background
- There is a code generation context setting on whether to consider "hardware transparency". By default this is set to false.
- The user must explicitly determine when this should be set to be true.
- As a convenience a "is transparent" heuristic utility traverses the shade tree at a given shader root and examines specific inputs and input values to determine if the shader is transparent.
- There have be requests to enhance this to recognize more cases. (the inputs considered are currently fixed)
- Depending on whether this option is set to true on not different code is generated.
Proposed Items To Examine:
- Whether the code to support transparency should always be emitted to avoid re-generating code which can be costly.
- If unique shaders are cached then 2 versions are required to support "transparent" and "opaque" variants, or the same shader may need to be regenerated + replaced on value changes.
- A value change implies a shader regeneration requirement but there is no support for this mechanism of detection.
- Whether the heuristic is too strict in checking for specific values to determine if a shade tree is (as opposed to could be transparent).
transmission is not included in the final color computation and instead relies on h/w alpha blending which is a "cheap" way to draw transparent objects. This should be re-examined as this may not be a given.
- Enhance heuristics to allow for additional inputs to be checked with custom logic. e.g. should
transmission_color be checked for "unlit" shader.
- do we still want to add support for a transparency "hint" attribute as proposed in the current 1.39 specification ? A suggestion from @niklasharrysson is that we move such a hint to
<implementation>s as this has as it's main usage hardware rasterizers.
- more?
Appendix:
Some examples of such as switch:
This issue has been logged for discussion purposes
Background
Proposed Items To Examine:
transmissionis not included in the final color computation and instead relies on h/w alpha blending which is a "cheap" way to draw transparent objects. This should be re-examined as this may not be a given.transmission_colorbe checked for "unlit" shader.<implementation>s as this has as it's main usage hardware rasterizers.Appendix:
Some examples of such as switch:
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXGenGlsl/Nodes/SurfaceNodeGlsl.cpp#L201
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXGenGlsl/GlslShaderGenerator.cpp#L643
An unlit surface shader constructor node. #860