Comments (4)
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.
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.
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.
Thanks for this original report, @numega, and thanks to @niklasharrysson for addressing it in #981!
from materialx.
Related Issues (20)
- Clarify ABI compatibility rules in MaterialX HOT 5
- Suggestion: Add more Global Nodes HOT 3
- Proposal: Apply convert node rules to image edge cases
- Not all math functions are documented in the specification. HOT 4
- 1.39 "channels" upgrade in creating incorrect connections on some nodegraph configurations HOT 2
- Allow users to input values in Web Viewer outside of soft min and max values
- Bump node not working with genglsl
- 1.39 "channels" upgrade issue due to value vs. connection priority logic HOT 1
- 1.39 channels upgrade attempts to create invalid swizzle / extract for float -> float extraction HOT 1
- Validation incorrectly categorizes top level inputs connected to graphs as invalid
- Setting an element's colorspace attribute to empty string has unexpected behavior
- Query: What is supposed to happen with multiple <materialx> tags in a document ? HOT 1
- Cloverleaf placement appears incorrect HOT 5
- Support updating references when renaming a node or nodegraph HOT 1
- ShaderGeneration common initialization
- Shader Generation Regression: Real world units on filenames + target unit not working
- Proposal: Add `thinfilm_weight` input to supporting BSDF nodes HOT 2
- Graph fails on name conflicts across namespaces HOT 4
- HwTimeNode hardcodes frame rate in generated code instead of using the fps uniform
- Survey of type conversions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialx.