I suspect I have found a shader generation bug. It appears that using a <position> inside a nodegraph, and exposing the space parameter via the interface name mechanism appears to not generate valid shader code, either in MSL or OSL.
Using the <position> node alone appears to work.
<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
<position name="myPos" type="vector3">
<input name="space" type="string" value="object"/>
</position>
<convert name="conv" type="color3">
<input name="in" type="vector3" nodename="myPos"/>
</convert>
<surface_unlit name="Srf" type="surfaceshader">
<input name="emission_color" type="color3" nodename="conv" />
</surface_unlit>
<surfacematerial name="Mtl" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="Srf" />
</surfacematerial>
</materialx>
But the following doesn't work
<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
<nodedef name="ND_positionwrapper" node="positionwrapper">
<input name="wrap_space" type="string" value="object" enum="model, object, world" uniform="true"/>
<output name="out" type="vector3"/>
</nodedef>
<nodegraph name="NG_positionwrapper" nodedef="ND_positionwrapper">
<position name="myPos" type="vector3">
<input name="space" type="string" interfacename="wrap_space"/>
</position>
<output name="out" type="vector3" nodename="myPos"/>
</nodegraph>
<positionwrapper name="myPosWrapper" type="vector3">
<input name="wrap_space" type="string" value="object"/>
</positionwrapper>
<convert name="conv" type="color3">
<input name="in" type="vector3" nodename="myPosWrapper"/>
</convert>
<surface_unlit name="Srf" type="surfaceshader">
<input name="emission_color" type="color3" nodename="conv" />
</surface_unlit>
<surfacematerial name="Mtl" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="Srf" />
</surfacematerial>
</materialx>
It's possible I'm holding it wrong. If I am I'd love to be schooled by someone.
This is obviously a toy example, but I'm trying to build some custom node definitions that are using <position> internally, exposing the space parameter back to the user.
I suspect I have found a shader generation bug. It appears that using a
<position>inside a nodegraph, and exposing thespaceparameter via theinterface namemechanism appears to not generate valid shader code, either in MSL or OSL.Using the
<position>node alone appears to work.But the following doesn't work
It's possible I'm holding it wrong. If I am I'd love to be schooled by someone.
This is obviously a toy example, but I'm trying to build some custom node definitions that are using
<position>internally, exposing thespaceparameter back to the user.