Re: [osg-users] How to access material properties from a GLSL shader?

2020-01-10 Thread Armin Samii
Thanks, Chris. Those materials are not available post-GLES 1.2, and I
couldn't find anywhere in the OSG codebase that exposed materials as
uniforms. I did find this:
https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/Lighting.cpp

Which traverses the scene graph, finds Materials, and replaces them with
Uniforms. I think that's a reasonable solution.

- Armin

On Wed, Jan 8, 2020 at 6:21 PM Chris Djali / AnyOldName3 <
krizdj...@gmail.com> wrote:

> Hi,
>
> 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: http://mew.cx/glsl_quickref.pdf. 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.
>
> I *think* 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.
>
> Hope this helps,
>
> Chris
>
> On Wednesday, 8 January 2020 22:53:28 UTC, Armin Samii wrote:
>>
>> 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?
>>
>> For context: I had an OBJ/MTL that loaded and rendered fine by default,
>> but when I turn on `setUseVertexAttributeAliasing`, 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.
>>
>> (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.)
>>
> --
> You received this message because you are subscribed to the Google Groups
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osg-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osg-users/5b4d4380-6d02-4726-a13f-2068c47d70d6%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/CAM8Fz%2BmB-TPGrfgOePKyQojNun31Qw7%2BQFhFHNKH8Y5WRggBRg%40mail.gmail.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Loading textured meshes (obj+mtl) leads to crash in osg 3.4.1

2020-01-10 Thread Robert Osfield
On Friday, 10 January 2020 18:01:57 UTC, Tom Pollok wrote:
>
> When loading a textured mesh from an obj file with mtl + texture file, 
> openscenegraph crashes.
>
> I use openscenegraph 3.4.1. Does anybody know if that issue has been fixed 
> in newer versions?
>

I don;t recall reports of crashes associated with .obj.

Could you provide a link to the model that is causing the problem?

Could you provide a stack trace?

What platform are you working on?  Did you build the OSG yourself?  

What hardware are you working on?

Cheers,
Robert,

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/3cd85069-be12-48b7-96d6-679348a35f50%40googlegroups.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Loading textured meshes (obj+mtl) leads to crash in osg 3.4.1

2020-01-10 Thread 'Tom Pollok' via OpenSceneGraph Users
When loading a textured mesh from an obj file with mtl + texture file, 
openscenegraph crashes.

I use openscenegraph 3.4.1. Does anybody know if that issue has been fixed 
in newer versions?

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/a6713d30-91b6-49b3-a240-d98f87781461%40googlegroups.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unwanted culling in 3.6.4 vs 3.5.1

2020-01-10 Thread Robert Osfield
Thanks Anders, the description and models really helped pin point the bug
and confirm fix. I have now fixed the handling of when
_autoScaleTransitionWidthRatio<=0.0


https://github.com/openscenegraph/OpenSceneGraph/commit/61c7ee76c5c059f53366f69c27c9fdf69388eced

This is checked into master and the 3.6 branch so will be part of the up
coming 3.6.5 release.

Cheers,
Robert.

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/CAFN7Y%2BVc0SZbBvVP7YYMM3xrOXYBXcf8EUL9uusdCwSTeC-uFA%40mail.gmail.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/CAFN7Y%2BVc0SZbBvVP7YYMM3xrOXYBXcf8EUL9uusdCwSTeC-uFA%40mail.gmail.com.


Re: [osg-users] Unwanted culling in 3.6.4 vs 3.5.1

2020-01-10 Thread Robert Osfield
As a reminder I've added an Issue with this bug on github:

   https://github.com/openscenegraph/OpenSceneGraph/issues/892
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unwanted culling in 3.6.4 vs 3.5.1

2020-01-10 Thread Robert Osfield
Hi Anders,

On Thu, 9 Jan 2020 at 14:07, Anders Backman  wrote:

> Problem solved:
>
> obj->setAutoScaleTransitionWidthRatio(0.001f); // Was 0 earlier.
>
> This seems to be something that changed between the two versions!
> Now it works.
>

Good to hear that you've found a workaround.

There were a number of fixes made to osg::AutoTransform so it looks like
one of the changes has created a regression for your usage case.  This is
why I make so many calls for testing before release go out so we can catch
these cases where the changes are still relatively fresh in out minds.

This commit may have made the code sensitive to a zero
setAutoScaleTransitionWidthRatio :


https://github.com/openscenegraph/OpenSceneGraph/commit/92092a56ae920b41b25b984592d69a7aaba28480#diff-02ae8731c81cbf820759403a17780405

I think this PR addresses a bug associated with using AutoTransforms in
multiple views at one time.  Looking at the code I wonder if the commented
out line (line 153 of src/osg/AutoTransform.cpp):

//if (_autoScaleTransitionWidthRatio>0.0)

Is what has introduced this sensitivity to a zero value
of_autoScaleTransitionWidthRatio.
The following code block looks like it would provoke a divide by zero with
a _autoScaleTransitionWidthRatio of zero when the i and j values ended
becoming the same value.

I will need to think about what should be happening in the code in your
usage case.  Do you know what was intended with the original settings?  I'm
a bit cold on this code as it's nearly three years since I last worked on
it.

For the upcomming 3.6.5 release I'd like to get a fix checked in to handle
this case.

Cheers,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org