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
powerus...@live.com.au.
?
From: osg-users on behalf of
osg-users-requ...@lists.openscenegraph.org
Sent: Saturday, 17 November 2018 8:04 AM
To: osg-users@lists.openscenegraph.org
Subject: osg-users Digest, Vol 137, Issue 14
Send osg-users mailing list submissions to
osg-users@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-requ...@lists.openscenegraph.org
You can reach the person managing the list at
osg-users-ow...@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"
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <1542367795.m2f.75...@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
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <50c2565b-79f0-a8b9-4227-dc371c7b2...@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@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"
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] OpenGL ES 2.0 and LIGHTING
Message-ID: <1542384039.m2f.75...@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?