MaterialX
MaterialX copied to clipboard
Handling of missing geomprops in GLSL backend
trafficstars
When loading the following document:
<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
<geompropvalue name="N_missing_geomprop" type="color3">
<input name="geomprop" type="string" value="missing" />
<input name="default" type="color3" value="0.0, 0.0, 1.0" />
</geompropvalue>
<UsdPreviewSurface name="SR_missing_geomprop" type="surfaceshader">
<input name="diffuseColor" type="color3" nodename="N_missing_geomprop" />
</UsdPreviewSurface>
<surfacematerial name="MAT_missing_geomprop" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="SR_missing_geomprop" />
</surfacematerial>
</materialx>
MaterialXView displays an error: "Geometry buffer could not be retrieved for binding: i_geomprop_missing. Index 0".
I don't think this is correct behaviour. The <geompropvalue> node has a default input which's value should be used instead.
@pablode Good catch, and your description of the intended behavior matches my understanding of the specification. Here is the method in MaterialXRenderGlsl that generates this warning, and it seems logical to implement the correct fallback behavior there:
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXRenderGlsl/GlslProgram.cpp#L273