Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Paul Griffiths
umituzun84 wrote: > Hi Paul; > > Watch the video. It can tell you much of dot and cross product :) > > http://video.google.com/videosearch?q=cross+product&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&um=1&ie=UTF-8&ei=LE4dSreZCpLt_AbS4OGxDQ&sa=X&oi=video_result_group&resnum=4&ct=title

Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Ümit Uzun
Hi Paul; Watch the video. It can tell you much of dot and cross product :) http://video.google.com/videosearch?q=cross+product&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&um=1&ie=UTF-8&ei=LE4dSreZCpLt_AbS4OGxDQ&sa=X&oi=video_result_group&resnum=4&ct=title# Regards. 2009/5/27 Paul G

Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Paul Griffiths
Kim C Bale wrote: > I presume this line: > > n = (pos1 -pos0) ^ (pos2 - pos1); > > is a cross product of two vectors. i.e. the normal, also known as the > vector perpendicular to the two vectors that define the plane. > > In which case you would want to use the glsl function cross(vec3,vec3) >

Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Kim C Bale
...@lists.openscenegraph.org] On Behalf Of Paul Griffiths Sent: 27 May 2009 13:40 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] vertex shader help: compare position against plane ok, i got the world position with: Code: mat4 ToWorldMatrix= osg_ViewMatrixInverse* gl_ModelViewMatrix; vec3 worldPos

Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Paul Griffiths
ok, i got the world position with: Code: mat4 ToWorldMatrix= osg_ViewMatrixInverse* gl_ModelViewMatrix; vec3 worldPos = ToWorldMatrix * gl_Vertex; now i need to check which side of the plane the worldPos is. I googled and found some code for this but its not for glsl, ive came up with this b

Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Kim C Bale
al Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Griffiths Sent: 27 May 2009 12:02 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] vertex shader help: compare position against plane I know the code: vec

Re: [osg-users] vertex shader help: compare position against plane

2009-05-27 Thread Paul Griffiths
I know the code: vec3 worldPos = gl_ModelViewMatrix * gl_Vertex; is worng, if i rotate the view so does this position. i need the world position and not the modelview position. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=13023#13023

Re: [osg-users] vertex shader help: compare position

2009-05-27 Thread Sebastian Messerschmidt
Hi Paul, I guess the problem is related to the "varying". AFAIR it is interpolated over the primitive. So maybe this is the problem. The other odd thing is that you do if (inside) discard; instead of if (inside == 1.0) discard; cheers Sebastian Hi, Im trying to use a shader to make p

[osg-users] vertex shader help: compare position

2009-05-27 Thread Paul Griffiths
Hi, Im trying to use a shader to make parts of models transparant(clipped) i was using a clipnode but learned you cant use more than one in a scene? or am i wrong? anyway, i wish to clip along a plane. currently this plane is defined as 3 points: Code: varying vec3 pos0; varying vec3 pos1; v