Sign in to follow this  
DyeDrin

glsl and clipping plane

Recommended Posts

I'm writing a simple raycaster in glsl but wish to add the ability to move the camera into the volume. This requires information about the clipping plane (specifically the near clipping plane) inside the fragment shader. Is there any way I can grab information regarding the clipping planes inside the shader? I know there's a gl_ClipPlane[gl_MaxClipPlanes] however I have been unable to figure out what exactly it stores nor how to use it. More specifically I need to figure out if the near clipping plane is inside the volume and if it is change the starting point for the ray from the vertex to the near clipping plane. Any help would be appreciated. Thanks.

Share this post


Link to post
Share on other sites
You can write the Near-Plane into one of the OpenGL hardware Clipping Planes, and then read it out in the Shader. Or you get the Near Clipping plane out of the Projeciton Matrix in the shader.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this