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 

Transform matrix as Uniform to shaders


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
freqfly
Newbie


Joined: 13 Dec 2016
Posts: 10

PostPosted: Thu Oct 05, 2017 4:19 am    Post subject:
Transform matrix as Uniform to shaders
Reply with quote

Hi,

I need a matrix for the transform from root scene node to the node where the mesh the shaders currently are operating on is in.

Does OSG pass such a matrix automatically to the shaders?
If yes, is there other uniforms passed and is there a list of them somewhere?

Sorry if my question is dumb, I am new to shaders.

Thank you!
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12215

PostPosted: Thu Oct 05, 2017 10:58 am    Post subject:
Transform matrix as Uniform to shaders
Reply with quote

Hi Nikolai,


If you are using a GL2 build of the OSG then you can just use the built-ins like gl_ModelViewMatrix.  If you are using GL3/GLCoreProfile or GLES2 then you'll tell the OSG to provide osg_ModelViewMatrix etc. in place of the gl_ModelViewMaitrx etc.


You can tell the OSG to provide the osg_ variations by setting the osg::State::setUseModelViewAndProjectionUniforms(true), but if your are building the OSG using GLES2/GLES3 or GL3/GLCoreProfile then this setting will be true by default.


Have a look at the osgshaders and osgsimplegl3 examples.


Robert.


On 5 October 2017 at 05:19, Nikolai Christensen < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I need a matrix for the transform from root scene node to the node where the mesh the shaders currently are operating on is in.

Does OSG pass such a matrix automatically to the shaders?
If yes, is there other uniforms passed and is there a list of them somewhere?

Sorry if my question is dumb, I am new to shaders.

Thank you!

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 824

PostPosted: Thu Oct 05, 2017 1:52 pm    Post subject:
Transform matrix as Uniform to shaders
Reply with quote

Hi Nickolai,

In case you're really after the ModelMatrix you need to use the
osg_ViewMatrixInverse and multiply it with your current
osg_ModelViewMatrix.

As Robert already mentioned you need to set the
osg::State::setUseModelViewAndProjectionUniforms(true) in order to make
this work.

Cheers
Sebastian

Quote:
Hi,

I need a matrix for the transform from root scene node to the node where the mesh the shaders currently are operating on is in.

Does OSG pass such a matrix automatically to the shaders?
If yes, is there other uniforms passed and is there a list of them somewhere?

Sorry if my question is dumb, I am new to shaders.

Thank you!

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









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
freqfly
Newbie


Joined: 13 Dec 2016
Posts: 10

PostPosted: Sun Oct 08, 2017 2:19 pm    Post subject:
Reply with quote

Thank you!

Cheers,
Nikolai
Back to top
View user's profile Send private message
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 Converting an osg::Matrix to osg::Pos... Waaayoff General 0 Fri Jan 18, 2019 3:34 pm View latest post
No new posts Can i use MatrixTransform to transfo... PeterGao General 8 Fri Jan 04, 2019 1:46 pm View latest post
No new posts EXTERNAL: Re: Value of a variable in... Rowley, Marlin R General 3 Fri Sep 28, 2018 1:39 pm View latest post
No new posts Value of a variable in shaders? Rowley, Marlin R General 4 Thu Sep 27, 2018 6:14 pm View latest post
No new posts Absolute final world position matrix ... Steal General 1 Mon Sep 24, 2018 11:25 am 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