Hi
 
Not sure if it is still true, but last time i used this stuff with stereo setups (not sure but it can hold for any offset-based slave cameras setup) osg_ViewMatrix and it's inverse was containing main camera view (and inverse) matrix and was same for both eyes.
 
Cheers,
Sergey.
 
20.12.2012, 00:12, "Glenn Waldron" <[email protected]>:
vec4 worldVert = osg_ViewMatrixInverse * gl_ModelViewMatrix * gl_Vertex;
 
...where osg_ViewMatrixInverse is a built-in OSG uniform (type mat4).
 
Just be aware: GLSL is single-precision, so you will lose some precision doing this.

Glenn Waldron / @glennwaldron


On Wed, Dec 19, 2012 at 3:03 PM, Ethan Fahy <[email protected]> wrote:
Hello all,

I would like to have access to vertex world coordinates in my GLSL vertex shader that is attached to an osg::Node.  In GLSL the Model Matrix and the View Matrix are combined into the ModelViewMatrix, so you cannot get access to the Model Matrix without either passing in the Model Matrix itself or the Inverse View Matrix (which could be multiplied by the ModelViewMatrix to get the Model Matrix).  I am familiar with how to attach an osg::Uniform to pass uniforms into the shader; my question is, what is the best way to obtain either the Model Matrix or the Inverse View Matrix from a given osg::Node?

I think I may be able to use osg::getLocalToWorld() to obtain the Model Matrix?

I have read through this thread:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-April/009903.html
but it doesn't really arrive at a satisfying conclusion and may or may not be out of date.  Any advice is appreciated.  Thanks,

-Ethan

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

,

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to