segs.setThickness() isn't reducing line thickness

the decimal figure variables are just as thick as 1

What antialiasing mode do you have enabled?

Yea I’ve never heard of that

Try:

node.setAntialias(AntialiasAttrib.MLine)

The antialias mode affects how the line thickness works.

from pandac.PandaModules import Vec4
from pandac.PandaModules import LineSegs
import direct.directbase.DirectStart
#from pandac.GraphicsEngine import GraphicsEngine
import math
import time



base.setBackgroundColor(0, 0, 0)
base.disableMouse( )
base.camera.setPos( 0, 0, 90)
base.camera.lookAt( 0, 0, 0 )
#globalClock.setMode(ClockObject.MLimited)
globalClock.setFrameRate(1000)
cos=math.cos
sin=math.sin
pi=math.pi
for x in range(1,3):
	if x==1:
		Px=-15
		Py=0
		red=0
		g=0
		b=1
		num=800
		Factor=300
		r=15
	if x==2:
		Px=15
		Py=0
		red=.5
		g=0
		b=0
		num=700
		Factor=220
		r=15
	for i in range(0,num):
		P=i*Factor;
		while P>num:
			P=P-num
		x1=r*cos(i*2*pi/num)+Px
		y1=r*sin(i*2*pi/num)+Py
		x2=r*cos(P*2*pi/num)+Px
		y2=r*sin(P*2*pi/num)+Py
		segs = LineSegs( )
		
		segs.setThickness(.001)
		segs.setColor(red,g,b)
		segs.moveTo(x1,y1,0 )
		segs.drawTo( x2,y2,0 )
		
		f=segs.create( )
		render.attachNewNode( f )
		base.graphicsEngine.renderFrame()
		

base.run()

I’m using segs they don’t seem to recognize setAntialias

In OpenGL, for non-integer line thicknesses to have any effect, you need to enable antialiasing. For simple line antialiasing, you can set:

fnp = render.attachNewNode( f )
fnp.setAntialias(AntialiasAttrib.MLine)

Where AntialiasAttrib is imported like this:

from panda3d.core import AntialiasAttrib

However, line thicknesses lower than 1 may not be supported by your GPU, or they may simply be implemented by decreasing the line’s opacity. This is not something that Panda can do something about, since it’s up to the video driver to implement line thickness.

Another antialiasing mode to try out could be multisampling, which requires putting this at the top of your file:

from panda3d.core import loadPrcFileData
loadPrcFileData("", """
framebuffer-multisample true
multisamples 8
""")

and enabling the following antialiasing mode:

fnp = render.attachNewNode( f )
fnp.setAntialias(AntialiasAttrib.MMultisample)

…however, this is not guaranteed to give you results for line thicknesses lower than 1 either.

Oh ok thanks for your help