[osg-users] osg-users Digest, Vol 137, Issue 14
A Z
poweruserm at live.com.au
Fri Nov 16 15:15:51 PST 2018
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
poweruserm at live.com.au.
?
________________________________
From: osg-users <osg-users-bounces at lists.openscenegraph.org> on behalf of osg-users-request at lists.openscenegraph.org <osg-users-request at lists.openscenegraph.org>
Sent: Saturday, 17 November 2018 8:04 AM
To: osg-users at lists.openscenegraph.org
Subject: osg-users Digest, Vol 137, Issue 14
Send osg-users mailing list submissions to
osg-users at 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-request at lists.openscenegraph.org
You can reach the person managing the list at
osg-users-owner at 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" <digitalw0lf at yandex.ru>
To: osg-users at lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <1542367795.m2f.75204 at 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 <Werner.Modenbach at texion.eu>
To: osg-users at lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <50c2565b-79f0-a8b9-4227-dc371c7b2e25 at 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 -
Am 16.11.2018 um 12:29 schrieb Grigoriy Mylnikov:
> 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
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------------------
Message: 3
Date: Fri, 16 Nov 2018 17:00:39 +0100
From: "Grigoriy Mylnikov" <digitalw0lf at yandex.ru>
To: osg-users at lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <1542384039.m2f.75206 at 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-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------------------
End of osg-users Digest, Vol 137, Issue 14
******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20181116/cbfb35d0/attachment.html>
More information about the osg-users
mailing list