<div dir="ltr">Hi,<div><br></div><div>osg::Material pretty much encapsulates OpenGL's fixed-function material state, so things like glMaterialfv (that controls material settings for whole draw calls) and glColorMaterial (that controls what vertex colours actually affect). If you're using a suitably old GLSL version, you can access this state through the built-in uniforms. These aren't featured prominently in lots of the modern OpenGL documentation like the wiki as they're removed in modern OpenGL, but I have this bookmarked and it at least says what's there: <a href="http://mew.cx/glsl_quickref.pdf">http://mew.cx/glsl_quickref.pdf</a>. Once you know an actual uniform name, relevant stuff should show up in a search engine. The one problem you'll hit is that there's no built-in uniform to say whether glColorMaterial is enabled or what mode it's in, so you'll have to set that up yourself with a uniform or shader define.</div><div><br></div><div>I <i>think</i> that with the right combination of settings, OSG exposes similar uniforms in newer OpenGL/GLSL versions where the fixed function pipeline has been removed, so that's something to look into. I've never needed this, though, so don't know if it just happens when OSG is compiled with GL3 support, or whether there's more that you need to do.</div><div><br></div><div>Hope this helps,</div><div><br></div><div>Chris<br><br>On Wednesday, 8 January 2020 22:53:28 UTC, Armin Samii wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr">Does openscenegraph provide easy access to osg::Material values in the shaders? If so, in which Uniforms are the various properties set? If not, is the best path forward to set my own Uniforms based on osg::Material?<div><br></div><div>For context: I had an OBJ/MTL that loaded and rendered fine by default, but when I turn on `<wbr>setUseVertexAttributeAliasing`<wbr>, the texture coordinates seem to break. I am trying to replace the default rendering with my own shader instead, but can't reproduce the original look and feel. While texture coordinates and texture loading does work with shaders, I cannot seem to find how to access the colors specified in the MTL files.</div><div><br></div><div>(A google search shows several results for "openscenegraph material shaders" which looks helpful, but they are all in the forum, which is now inaccessible. Apologies if this question has been asked and answered elsewhere.)</div></div></blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/5b4d4380-6d02-4726-a13f-2068c47d70d6%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/5b4d4380-6d02-4726-a13f-2068c47d70d6%40googlegroups.com</a>.<br />