PDA

View Full Version : Support for line smoothing in float fbo



tellaman
11-19-2008, 01:57 AM
Hi all,

I can't get line smoothing to work in a float fbo with color texture attachment and depth renderbuffer on my 8600M GS (ForceWare 176.68), primitives are rendered as if line smooth was disabled. Haven't had the chance to test it on different hardware yet, but it appears to work fine in 8 bit buffers instead, is this a known issue?

Thanks for any help you may provide.

Ilian Dinev
11-19-2008, 05:15 PM
Have you tried whether it works with regular 32bpp RGBA backbuffer and then 32bpp RGBA FBO? I didn't manage to turn line antialiasing on, on the same hardware and driver.

Ilian Dinev
11-19-2008, 05:20 PM
Anyway, if you set glLineWidth(2.0f), then here's how to set the frag color's alpha for nice antialiasing:



varying vec2 texcoord0 : TEX0;
varying vec4 posix : TEX1;

#if IS_VERTEX
void main(){
texcoord0=gl_MultiTexCoord0.xy;
posix = ftransform();
gl_Position=posix + vec4(0,0,0,0.001);
}
#endif



#if IS_FRAGMENT

uniform sampler2D tex0 : TEXUNIT0;
void main(){
vec4 FinalColor = texture2D(tex0,texcoord0);

vec2 ScreenSizeHalf = vec2(1280/2,720/2);
vec2 posix1= (posix.xy/posix.w+1)*ScreenSizeHalf;
vec2 fpos = gl_FragCoord.xy;
float dist = distance(fpos,posix1);
FinalColor.w = 1-dist;
gl_FragColor = FinalColor;
}
#endif

tellaman
11-20-2008, 05:25 AM
Thanks for your reply.

As I stated before, regular 8bit-per-component buffers (back or fbo) are working fine, but I guess you meant testing with float color buffers.
Unfortunately it doesn't seem like my card supports any float pixel type for the back buffer, so apparently the test you suggested is not an option at the moment; the ARB_color_buffer_float extension is supported but the NVIDIA PixelFormat utility reports a number of float pixel types for pbuffers only, no support for drawing to window is provided. As for the programmable-pipeline solution, I'd rather not use shaders for line drawing since I'm afraid other drivers would much likely hit a software fallback.

Anyway, thanks again for your help, I'll go and test this on different hardware and possibly send a bug report to nv.