Hello.
I am trying to implement a few fragment algorithms using GLSL and FBO, i am using two textures for sampling normal and positions, Using GL_RGBA/GL_RGBA16F_ARB/GL_NEAREST/GL_CLAMP_TO_EDGE (tried a few other combinations GL_RGBA32F_ARB… no go) parameters when creating these two textures, everything is ok, but banding on Z axis is giving me nightmares, which all algorithms i use depend on sampling depth value.
Depth range is 0.1 - 20.0, also tried playing with depth values, which didn’t help.
// vertex shader for position texture
varying vec3 position;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
position = (gl_ModelViewMatrix * gl_Vertex).xyz;
}
// fragment shader for position texture
varying vec3 position;
void main()
{
gl_FragColor = vec4(position, 0.0);
}
// fragment shader, sampling position
uniform float inv_z; // 1.0/(far-near)
uniform sampler2D position;
varying vec2 texcoord;
void main()
{
vec4 O = texture2D(position, texcoord);
gl_FragColor = vec4(1.0 - O.z * inv_z);
}
Sadly my current developement card is an ATI (1950Pro), as you may know ATI have some problems implementing GLSL + FBO-MRT, which costed a week of mine to find out what is actually going on, i started to think this is another GLSL + FBO issue of ATI cards.
Anyone has any ideas, if it is an issue or i am doing something wrong?
Thank you.