Re: [osg-users] transforming a directional vector into eye-space

2014-08-12 Thread Bram Vaessen
ok thanks :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60636#60636 ___ osg-users mailing list osg-users@lists.openscenegraph.org

[osg-users] transforming a directional vector into eye-space

2014-08-11 Thread Bram Vaessen
Hi, In my shader I would like to have the direction of the light (sunlight) in eye-space, and since it doesn't vary per vertex I would like to pre-calculate it in OSG. I'm not sure how to do this, I thought it would make sense to multiply the view matrix with the direction of the light like

Re: [osg-users] transforming a directional vector into eye-space

2014-08-11 Thread Glenn Waldron
For vectors, You can use the model view matrix, but omit the translation component. I believe the call is Matrix::transform3x3. On Aug 11, 2014 12:40 PM, Bram Vaessen bram.vaes...@gmail.com wrote: Hi, In my shader I would like to have the direction of the light (sunlight) in eye-space, and

Re: [osg-users] transforming a directional vector into eye-space

2014-08-11 Thread Bram Vaessen
thanks I noticed I had to use the (vec3, matrix) version instead of the (matrix, vec3) version to make it work. So that does a v*M[0..2,0..2] However in the shader (glsl) it's gl_NormalMatrix * gl_Normal... seems to be the other way around. Any clarification on this? thanks!

Re: [osg-users] transforming a directional vector into eye-space

2014-08-11 Thread Paul Martz
The OpenGL spec and GLSL both use post-multiply notation. OSG uses pre-multiply notation. The two produce identical results because they do the same thing internally. -Paul On Mon, Aug 11, 2014 at 3:06 PM, Bram Vaessen bram.vaes...@gmail.com wrote: thanks I noticed I had to use the (vec3,