MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Graph Editor: loading material with invalid connections / type mismatches

Open marwie opened this issue 1 year ago • 0 comments

Hi,

again codegen produced some invalid MaterialX code where we connect a color4 node to a color3 output.

The GraphView happily displays this connection when opening the file

image

I'm only getting an error when trying to pipe the output then into the shader

image

Problematic material:

<?xml version="1.0"?>
<materialx name="" version="1.38" >
	<nodegraph name="needle_shadergraph" >
		<input name="_MyColor" type="color4" value="0.8962264, 0.2494215, 0.2494215, 1.0" />
		<constant name="_MyColor_constant" type="color4" >
			<input name="value" type="color4" interfacename="_MyColor" />
		</constant>
		<output name="_MyColor_constant_out" type="color3" nodename="_MyColor_constant" />
	</nodegraph>
	<standard_surface name="needle_standard_surface" type="surfaceshader" >
		<input name="base_color" type="color3" nodename="_MyColor_constant_out" />
		<input name="specular_roughness" type="float" value="1.0" />
		<input name="metalness" type="float" value="1.0" />
	</standard_surface>
	<surfacematerial name="Default" type="material" >
		<input name="surfaceshader" type="surfaceshader" nodename="needle_standard_surface" />
	</surfacematerial>
</materialx>

Also attaching a video illustrating the issue note that the invalid connection is correctly refused in the UI when trying to do it but not when loading the graph also note that when I connect the subgraph output to the shader we get compiler errors and rendering breaks due to the type mismatch

https://github.com/AcademySoftwareFoundation/MaterialX/assets/5083203/62136046-aa6e-4142-b01c-cfd0ef7380e3

marwie avatar Aug 16 '23 08:08 marwie