Hello,

yesterday i wrote a glsl displacement shader:

uniform sampler2D displMap;

void main()
{
  gl_TexCoord[0] = gl_MultiTexCoord0;
  vec4 tex = texture2D(displMap, gl_TexCoord[0].st);
  float displ = 0.3 * tex.r + 0.59 * tex.g + 0.11 * tex.b;
  vec4 vertex = vec4(gl_Normal * displ * 5.0 , 0.0) + gl_Vertex;
  gl_Position = gl_ModelViewProjectionMatrix * vertex;
}

Now my problem is the clipping. When I start the application and I turn around the objekt the displaced vertices and faces disappear. It seems to me that the vertices clipped in the front of the near plane.

Is the displacement of the vertices a problem relating to the clipping planes?

Cheers

Martin
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to