Coder Social home page Coder Social logo

Comments (4)

numega avatar numega commented on July 17, 2024

The OpenGL error is due to GlslProgram::unbindGeometry() being called for each assignment of the material. You can reproduce this issue with the shaderball.obj file in resources/Geometry. As a workaround I added the following at the beginning of the function:

void GlslProgram::unbindGeometry()
{
    if (_vertexArray == GlslProgram::UNDEFINED_OPENGL_RESOURCE_ID)
        return;

    glBindVertexArray(_vertexArray);

from materialx.

bernardkwok avatar bernardkwok commented on July 17, 2024

What you have should show up green without modification.

From an initial look, it appears to be an issue with having the <surfacematerial> in the nodegraph definition not picking up the default values properly for code generation.

For example this does pick up default values properly:

<?xml version="1.0"?>
<materialx version="1.38" colorspace="lin_rec709">
  <nodedef name="NG_mymaterial" node="mymaterial">
    <input name="colorA" type="color3" value="0, 0.5, 0" />
    <input name="colorB" type="color3" value="0, 0.5, 0" />
    <output name="out" type="surfaceshader" />
  </nodedef>
  <nodegraph name="blah" nodedef="NG_mymaterial" >
    <add name="add1" type="color3" nodedef="ND_add_color3">
      <input name="in1" type="color3" interfacename="colorA" />
      <input name="in2" type="color3" interfacename="colorB" />
    </add>
    <UsdPreviewSurface name="SR_default" type="surfaceshader">
        <input name="diffuseColor" type="color3" nodename="add1"/>
    </UsdPreviewSurface>
    <output name="out" type="surfaceshader" nodename="SR_default" />
  </nodegraph>
  <mymaterial name="Material1" type="surfaceshader" />
  <output name="test" nodename="Material1" type="surfaceshader" />
</materialx>

from materialx.

niklasharrysson avatar niklasharrysson commented on July 17, 2024

Just some more info from debugging this:

The problem is that when finding renderable elements in a document, for materials we dig into it and extract the surfaceshader connected inside/upstream. So in this case we extract the UsdPreviewSurface from inside the materials implementation graph and generate code for that. The problem is that we then lose all information about what is connected or set on the materials interface.

So we need to treat materials as renderable elements explicitly, without extracting their shaders. And as part of this we need to add support for code generation of material elements, including having materials implemented as graphs.

from materialx.

jstone-lucasfilm avatar jstone-lucasfilm commented on July 17, 2024

Thanks for this original report, @numega, and thanks to @niklasharrysson for addressing it in #981!

from materialx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.