Discussion:
[osg-users] osg-users Digest, Vol 137, Issue 14
A Z
2018-11-16 23:15:51 UTC
Permalink
Is there someone here who delete my entire osf forum login account?

http://forum.openscenegraph.org/viewtopic.php?p=75088#75088

My email address with that account is

***@live.com.au.

?
________________________________
From: osg-users <osg-users-***@lists.openscenegraph.org> on behalf of osg-users-***@lists.openscenegraph.org <osg-users-***@lists.openscenegraph.org>
Sent: Saturday, 17 November 2018 8:04 AM
To: osg-***@lists.openscenegraph.org
Subject: osg-users Digest, Vol 137, Issue 14

Send osg-users mailing list submissions to
osg-***@lists.openscenegraph.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

or, via email, send a message with subject or body 'help' to
osg-users-***@lists.openscenegraph.org

You can reach the person managing the list at
osg-users-***@lists.openscenegraph.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of osg-users digest..."


Today's Topics:

1. Re: OpenGL ES 2.0 and LIGHTING (Grigoriy Mylnikov)
2. Re: OpenGL ES 2.0 and LIGHTING (Werner Modenbach)
3. Re: OpenGL ES 2.0 and LIGHTING (Grigoriy Mylnikov)


----------------------------------------------------------------------

Message: 1
Date: Fri, 16 Nov 2018 12:29:55 +0100
From: "Grigoriy Mylnikov" <***@yandex.ru>
To: osg-***@lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <***@forum.openscenegraph.org>
Content-Type: text/plain; charset=UTF-8

Sorry for delayed reply.

My goal is to open and display .osgt files on android the same way they can be opened on desktop. This includes using several lights inside a model, both directional and point lights.

I have some progress with writing shaders, but I have troubles with understanding OSG states. I've updated osg::Light apply() code to pass light position (relative to camera) as uniform:


Code:
void LightShader::apply(osg::State& state) const
{
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
... // Original code
#else
...
osg::Vec4 relPos = state.getModelViewMatrix() * _position;
lightPosUniform.get()->set(relPos);
...
#endif
}




But it seems that state.getModelViewMatrix() does not gives me valid view matrix.

If I could get light position (relative to camera), I can use it in shaders like this:


Code:
vec3 APos = vec3(gl_ModelViewMatrix * gl_Vertex);
...
vec3 fromPointToLight = lightPos.xyz - APos;




------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75204#75204







------------------------------

Message: 2
Date: Fri, 16 Nov 2018 12:36:39 +0100
From: Werner Modenbach <***@texion.eu>
To: osg-***@lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <50c2565b-79f0-a8b9-4227-***@texion.eu>
Content-Type: text/plain; charset=utf-8

Hi Grigoriy,

why don't you do the multiply in the shader like you do with gl_vertex?

- Werner -
Sorry for delayed reply.
My goal is to open and display .osgt files on android the same way they can be opened on desktop. This includes using several lights inside a model, both directional and point lights.
void LightShader::apply(osg::State& state) const
{
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
... // Original code
#else
...
osg::Vec4 relPos = state.getModelViewMatrix() * _position;
lightPosUniform.get()->set(relPos);
...
#endif
}
But it seems that state.getModelViewMatrix() does not gives me valid view matrix.
vec3 APos = vec3(gl_ModelViewMatrix * gl_Vertex);
...
vec3 fromPointToLight = lightPos.xyz - APos;
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75204#75204
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------------------

Message: 3
Date: Fri, 16 Nov 2018 17:00:39 +0100
From: "Grigoriy Mylnikov" <***@yandex.ru>
To: osg-***@lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <***@forum.openscenegraph.org>
Content-Type: text/plain; charset=UTF-8

After some trial and errors, I managed to do it in shader. But this means one redundant matrix multiplication per each vertex. Isn't it more effective to compute it once per frame on cpu side?

What's the purpose of state.getModelViewMatrix()? I expected to get a camera*model matrix there. Or it is not yet defined at the moment lights are applied?

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75206#75206







------------------------------

Subject: Digest Footer

_______________________________________________
osg-users mailing list
osg-***@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------------------

End of osg-users Digest, Vol 137, Issue 14
******************************************

Loading...