Closed numega closed 2 years ago
Unfortunately at this time custom output types like the struct you have is not supported by code generation.
For the case shown here, the "myoutput" struct will need to be split into two separate outputs on your "myfunc" definition. These can then be connected to (as opposed to members of the output).
For the implementation, I think the following should work:
void myfunc(vec3 in1, vec3 in2, out vec3 color, out float roughness)
{
color = in1 + in2;
roughness = 0.5;
}
If not then a nodegraph based implementation may be required.
Thanks for this report, @numega, and @bernardkwok is correct that member elements have never been supported in the MaterialX code generators.
Our current sense is that multi-output nodes are a better solution to the problem that member elements were originally proposed to solve, and we're leaning towards removing member elements from the 1.39 specification.
If you'd like to join the conversation around the 1.39 specification, we'd definitely appreciate your input on the MaterialX channel of the ASWF Slack:
https://www.materialx.org/DiscForum.html
For now, I'll close this original report, and we can continue the discussion on the ASWF Slack as needed.
I believe the MaterialX file listed below should work. However, I get the following warnings:
After printing the warnings, MaterialView crashes on this line due to
type
being a nullptr:throw ExceptionShaderGenError("No syntax is defined for the given type '" + type->getName() + "'.");
I'm not sure how blah2.glsl should be written in this case, but this is what I'm trying: