Re: [osg-users] Need Help ! How to get Camera Position inside shaders

2011-01-13 Thread Frederic Bouvier
Hi Laith, OSG defines the osg_ViewMatrixInverse uniform. You have to add uniform mat4 osg_ViewMatrixInverse; in your shader to use it and find the camera location in world coordinates. Otherwise, there is the gl_ModelViewMatrixInverse uniform if you want to transform the camera position from e

Re: [osg-users] Need Help ! How to get Camera Position inside shaders

2011-01-13 Thread Robert Osfield
Hi Laith, In OpenGL the camera position is always at 0,0,0, and the scene is transformed into cameras coordinates by the modelview matrix. So... one has to ask are you wanting to do calculations in the eye/camera coordinates, world coordinates or local object coordinates? You can transform the c

Re: [osg-users] Need Help ! How to get Camera Position inside shaders

2011-01-13 Thread David Callu
Hi Lait, If you want the camera position in world coordinate, you have to pass it yourself. OSG, like OpenGL only work in Eye Coordinate inside the shader. HTH David Callu 2011/1/13 Laith Dhawahir > Heey Guys, > I hope you will fine, > anyway, i have question about how i can get the camera po

[osg-users] Need Help ! How to get Camera Position inside shaders

2011-01-12 Thread Laith Dhawahir
Heey Guys, I hope you will fine, anyway, i have question about how i can get the camera position inside shader from open scene graph do i must pass it, or open scene graph already do that. Thank you! Cheers, Laith -- Read this topic online here: http://forum.openscenegraph.org/v