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;
varying vec3 pos2;
currently set as:
Code:
pos0.x = 0.0;
pos0.y = 0.0;
pos0.z = 0.0;
pos1.x = 0.0;
pos1.y = 1.0;
pos1.z = 0.0;
pos2.x = 0.0;
pos2.y = 0.0;
pos2.z = 1.0;
how do i check which side the current world position is compared to this plane?
ive tried
Code:
varying float inside;
...
vec3 worldPos = gl_ModelViewMatrix * gl_Vertex;
inside = 1.0;
if (worldPos.x < pos0.x)
{
inside = 0.0;
}
and inside my fragment shader im simply using
Code:
if (inside) discard;
which does cut the model in half but its jagged. its not removing pixels but
the whole vertex.
it is wrong. how do i get the current world position with the vertex shader?
and how can i check this position compared to the plane?
the example code above just checks x axis, i need all 3.
...
Thank you!
Cheers,
PaulG
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=13020#13020
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org