How to antialias offscreen buffer?

Hi all, I’m new (very new, in two weeks) in Panda3d and hence I use Panda3d 1.8.1. I’m trying to add my filter to the scene but found that the antialiasing doesn’t work for the offscreen buffer.
I add the filter by using the approach introcuded in the Manual:

manager = FilterManager(,
tex = Texture()
quad = manager.renderSceneInto(colortex=tex)
quad.setShaderInput("tex", tex)

The origin scene before I add above lines:

And after I add such lines, the result becomes:

I use a filter which simply output the tex to get that result:

void vshader(
    float4 vtx_position : POSITION,
    float2 vtx_texcoord0 : TEXCOORD0,
    out float4 l_position : POSITION,
    out float2 l_texcoord0 : TEXCOORD0,
    uniform float4 texpad_tex,
    uniform float4x4 mat_modelproj){
    l_position=mul(mat_modelproj, vtx_position);
    l_texcoord0 = vtx_position.xz * texpad_tex.xy + texpad_tex.xy;

void fshader(float2 l_texcoord0 : TEXCOORD0,
             out float4 o_color : COLOR,
             uniform sampler2D k_tex : TEXUNIT0){
    o_color = tex2D(k_tex, l_texcoord0);

I don’t know what goes wrong and I’ve tried adding antialiasing at different nodes but all of them failed, here’s the attempts I’ve tried:

Can anyone tell me what’s the problem? Thanks.

You also need to request a multisample buffer by adjusting the FrameBufferProperties of the buffer appropriately (by overriding createBuffer or however) before multisample antialiasing can work.

Thanks for your reply! …but the problem is not solved yet. I tried to modify the by adding a line:


in the createBuffer (where the 16 is obtained from )but gets a wierd dim scene:

After comparing the FrameBufferProperties of and the buffer I found that the depthbit is not equal (where the buffer is 1 and the is 24). Then I added another line trying to hack this:


Now the color is right again, but I got the edges PARTLY SMOOTH! :open_mouth:

I think the performance is between the two images I posted before, and get no idea again :frowning:

Call getFbProperties() on the buffer after it has been created and print it; does it meet the amount of bits that were requested?

Unfortunately, multisample buffers are a bit of an untested feature in Panda, so there may still be some bugs. You may also search the forums for FXAA, however, which I believe is antialiasing implemented as a postprocessing filter - this may be straightforward to integrate with FilterManager. I could be wrong, though.

Well the buffer’s property is the same as the, as follow:

I think I’m going to test such codes on another graphic card… and I’ll post the results later.

Another problem found. If I request a multisample buffer then the image will not change even if the model is moving. But if I delete that line it moves again (although the AA is still a problem).

One thing you can try to mimic a AA effect is to request a buffer 2x the size of
your screen resolution. When that oversized buffer is downsized to your
native screen resolution, the smoothing will effectively give you some filtering.
Your test pics look pretty simple shader wise, so you may not incur a large
speed penalty doing this.