Antialias on GeomPrimitives added to render2d/aspect2d

Hello!

Newbie panda3d user here :smiley: Starting off my forum existence here with a simple question:

How do I enable antialias on GeomLines which I add to render2d(or aspect2d)? I tired

self.render2d.setAntialias(AntialiasAttrib.MLine)

…and also…

nodePath.setAntialias(AntialiasAttrib.MLine)

…where nodePath is the NodePath to which I added the Geom. In either case, the line appears jagged. Is my code lacking, or are my eyes faulty?

Full code:

    self.render2d.setAntialias(AntialiasAttrib.MLine)
    
    vdata = GeomVertexData('line1', GeomVertexFormat.getV3c4(), Geom.UHStatic)
    vertex = GeomVertexWriter(vdata, 'vertex')
    color = GeomVertexWriter(vdata, 'color')
    
    vertex.addData3f(0, 0, 0)
    color.addData4f(1, 1, 1, 1)
    vertex.addData3f(1.3, 1, 1)
    color.addData4f(1, 1, 1, 1)
    
    l = GeomLines(Geom.UHStatic)
    l.addVertex(0)
    l.addVertex(1)
    l.closePrimitive()
    
    geom = Geom(vdata)
    geom.addPrimitive(l)
     
    node = GeomNode('gnode')
    node.addGeom(geom)
     
    nodePath = self.aspect2d.attachNewNode(node)
    nodePath.setAntialias(AntialiasAttrib.MLine)

BR // Astrogee

That seems correct, and indeed that code works fine on my machine. I can toggle back and forth between Antialias.MLine and Antialias.MNone and see the line changing visibly.

Note that some drivers don’t implement line-based antialiasing. Maybe you have one such lucky driver. It also might work only in OpenGL; I’m not sure whether it is implemented in our DirectX layer.

David

Thanks for you answer, David :slight_smile: I have tried toggling the AA settings and also the type of pipe. I can see no difference. I guess my driver is lacking then :frowning: