AcademySoftwareFoundation / MaterialX

MaterialX is an open standard for the exchange of rich material and look-development content across applications and renderers.
http://www.materialx.org/
Apache License 2.0
1.87k stars 353 forks source link

CurveAdjust implementation missing #674

Open swillisart opened 3 years ago

swillisart commented 3 years ago

Hello! I'm writing a MaterialX Maya File Translator And I just ran into a critical snag on the exporting of remap nodes as CurveAdjust. image The resulting example when loaded into MaterialXView yields an error.

<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
  <surfacematerial name="Plastic" type="material">
    <input name="surfaceshader" type="surfaceshader" nodename="SR_plastic" />
  </surfacematerial>
  <standard_surface name="SR_plastic" type="surfaceshader">
    <input name="base" type="float" value="1" />
    <input name="base_color" type="color3" nodegraph="NG_remapColor1" output="out" />
    <input name="specular_roughness" type="float" value="0.32467532157897949" />
  </standard_surface>
  <nodegraph name="NG_remapColor1">
    <curveadjust name="remap1" type="color3">
      <input name="in" type="color3" nodename="remapColor1" />
      <parameter name="knots" type="vector2array" value="[0.0, 0.5], [1.0, 1.0]" />
    </curveadjust>
    <ramplr name="remapColor1" type="color3">
        <input name="valuel" type="color3" value="0.0, 0.0, 0.0" />
        <input name="valuer" type="color3" value="0.5, 0.0, 0.0" />
        <input name="texcoord" type="vector2" defaultgeomprop="UV0" />
    </ramplr>
    <output  name="out" type="color3" nodename="remap1" />
  </nodegraph>
</materialx>

image

And when reading though the code it seems MaterialX does not actually have an implementation available and is commented out. Is this something actively being looked into with Autodesk or are you accepting PR's for curve lookups?

Best regards, -Sean

bernardkwok commented 3 years ago

Hi Sean, Thanks for bringing this up and it is true there is no curveadjust support currently, and from the Autodesk side it is not actively being looked at.

It would be great if you have something to put up. If you don't have all the language backends we could do one first and add the rest after we have one reference implementation.

swillisart commented 3 years ago

Sounds good Bernard, Created a PR Reference implementation of curveadjust I think I'm unable to link this Issue to the PR for some reason.

jstone-lucasfilm commented 2 years ago

It sounds like the best path forward will be to integrate the recent work from SideFX on MaterialX ramp nodes, which was discussed at the MaterialX TSC on November 9th:

https://academysoftwarefdn.slack.com/archives/C0230LWBE2X/p1636486452084200

I'll leave this original issue open for now, and we can revisit this as the work from SideFX is refined and integrated into MaterialX v1.39.

swillisart commented 2 years ago

That’s great news! I got stuck on the GLSL limitation of fixed-size array declaration. I have working shader code but it’s all pre-declared and does not accept dynamic inputs. Looking forward to the SideFX PR.

jstone-lucasfilm commented 2 years ago

This subject was discussed in more depth at today's MaterialX TSC meeting, and I'll include a link for those following the topic:

https://academysoftwarefdn.slack.com/archives/C0230LWBE2X/p1655837092353349

jstone-lucasfilm commented 1 month ago

Linking this earlier issue to the recent pull request to add a ramp node to MaterialX 1.39.2:

https://github.com/AcademySoftwareFoundation/MaterialX/pull/1884