Antialiasing not working properly


I have aliasing issues on Linux using Nvidia on-demand functionality specifically. If I start Python3 doing:


Then antialiasing is not applied apparently, even though it is saying the contrary if I print the frame buffer properties:

depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 multisamples=16 back_buffers=1 force_hardware force_software

I also checked that it really switches from Intel GPU to Nvidia with

Here yes a screenshot of the display. The aliasing is especially visible at the corner of the tile ground.

Any idea of what is happening and how to fix it ?

PS: on a different note, calling set_shader_off on a node causes crash of panda3d, but I don’t actually need it anyway.

I am assuming that checkerboard is a texture and not made from geometry. Multisample anti-aliasing will only smooth geometry edges. Something like FXAA needs to be used to also smooth edges found in textures. However, mipmapping (trilinear filtering) may also help in this case. You can enable trilinear filtering on a texture by using the FT_linear_mipmap_linear filter type.

Actually, the ground is procedurally generated:

def make_plane():
    vformat = GeomVertexFormat.get_v3n3t2()
    vdata = GeomVertexData('vdata', vformat, Geom.UHStatic)

    vertex = GeomVertexWriter(vdata, 'vertex')
    normal = GeomVertexWriter(vdata, 'normal')
    tcoord = GeomVertexWriter(vdata, 'texcoord')

    quad = ((0, 0), (1, 0), (0, 1), (1, 1))

    for u, v in quad:
        vertex.addData3(u - 0.5, v - 0.5, 0)
        normal.addData3(0, 0, 1)
        tcoord.addData2(u, v)

    prim = GeomTriangles(Geom.UHStatic)
    prim.addVertices(0, 1, 2)
    prim.addVertices(2, 1, 3)

    geom = Geom(vdata)
    return geom
for xi in range(-10, 11):
    for yi in range(-10, 11):
        tile = GeomNode(f"tile-{xi}.{yi}")
        tile_path = node.attach_new_node(tile)
        tile_path.set_pos((xi, yi, 0.0))
        if (xi + yi) % 2:
            tile_path.set_color((0.95, 0.95, 1.0, 1.0))
            tile_path.set_color((0.13, 0.13, 0.2, 1.0))

Oh, in that case, make sure MSAA is actually enabled with something like:


I’m already doing it. If I use the integrated graphics intel GPU I have no problem, online if offloading on Nvidia GPU.