Jump to content
  • Advertisement
Sign in to follow this  
SuperVGA

GLSL: Reading from two samplers problem

This topic is 3055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!