Sign in to follow this  
SuperVGA

GLSL: Reading from two samplers problem

Recommended Posts

SuperVGA    1132
First off, thanks to idinev for the help on reading the depth information off a FBO. I now have a shader that can display the underlying depth information like this:
vec4 tmp = texture2D(depthSampler, vec2(x,y));
dist_to_existing = depth_to_z(tmp.x, 1024.0, 0.1);
intensity = (dist_to_existing - 0.1) / 1024.0;
gl_FragColor.rgb = vec3(intensity);
return;

Colour to distance from camera:
float depth_to_z(float depth, float far, float near)
{
	return far * near / ( far - depth * (far- near));
}

Fragment shader configured for depth sampling I can switch it back to the original voxel-raycaster so it will look like this: Fragment shader configured for raycasting However, when i for instance multiply my colours returned from the raycaster, with the depth intensity, everything goes black, even though intensity for sure is between 0.0 and 1.0. I have 3 samplers; 2 2D samplers; one for depth texture attached to an FBO, one for ray directions. 1 3D sampler; contains the voxel set. (I do not write to gl_FragDepth) Any experience in this area? -Thanks in advance! [Edited by - SuperVGA on February 13, 2010 8:28:03 AM]

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