OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osg-users Digest, Vol 137, Issue 14


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
poweruserm@live.com.au
Guest





PostPosted: Fri Nov 16, 2018 11:16 pm    Post subject:
osg-users Digest, Vol 137, Issue 14
Reply with quote

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


.


?

From: osg-users <> on behalf of <>
Sent: Saturday, 17 November 2018 8:04 AM
To:
Subject: osg-users Digest, Vol 137, Issue 14

Send osg-users mailing list submissions to


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


You can reach the person managing the list at


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:
Subject: Re: OpenGL ES 2.0 and LIGHTING
Message-ID: <>
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:
Subject: Re: OpenGL ES 2.0 and LIGHTING
Message-ID: <>
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:
Quote:
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

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:
Subject: Re: OpenGL ES 2.0 and LIGHTING
Message-ID: <>
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

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

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

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Issue with osgt format on 3.6.x Riccardo Corsi General 1 Wed Apr 17, 2019 3:46 pm View latest post
No new posts Happy New Year to all OSG Users Chris Hanson General 0 Mon Jan 07, 2019 10:17 am View latest post
No new posts osg-users Digest, Vol 138, Issue 27 Zachary1234 General 0 Tue Jan 01, 2019 1:16 am View latest post
No new posts DrawCallback serialization issue jumaroch General 1 Tue Nov 27, 2018 2:26 pm View latest post
No new posts DrawCallback serialization issue jumaroch General 0 Tue Nov 27, 2018 1:44 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP