Does anyone care about Point based particles?

I mean… I know there’s particles and billboards available in panda,
but they all rely on quads afaik… which just sucks. Sorry. :3

Yes, the difference actually matters.

It’s not much of work anyway. Just the GL callback, enabling PointSprites and access
to PointSize and then setting up single vertices as points. The vertexshader related to
the pointsize is just two or three lines.

I can put up a basic example how it works. I’m not happy with Panda’s way of doing it,
especially because singlepoint particles were already a thing thousand gpu years ago already.

Please correct me if I am wrong.

Does anyone care?

I’m pretty sure panda already supports point rendering, you need to use a GeomPoints I guess. You could also use a geometry shader to emit them / or compute shader. I’m not sure if its possible to use the particle system with points tho

It doesn’t out of the box support modifying pointsize in the vertex shader,
which is essential to have single-point particles. You have to specifically enable that
using a GL callback.

You can modify the pointsize for ALL particles at once, but that’s kind of silly.

So … there’s support for Points, yes, but not specifically for particles.
It’s the thing that the billboards/particles in Panda use quads,
instead of points. That’s what I’m talking about.

It’s not a major issue, or actually not an issue at all.

It just bothers me that Panda is stuck with quads, when it shouldn’t be that way. :slight_smile:

IIRC panda uses native point rendering for “normal” points, and quads if you specify a dynamic point size (rdb, correct me if I’m wrong). I guess what you mean is the GL_PROGRAM_POINT_SIZE in combination with gl_PointSize in a vertex / geometry / tesseval shader, which is currently not supported I think, I bet it wouldn’t be hard to add at all tho.

Panda has no issues with point rendering. The point particle renderer does use points, and only converts to quads if the rendering API doesn’t support the point rendering method; I believe your frustration may be a bit misplaced.

I did regrettably forget to add the flag controlling GL_PROGRAM_POINT_SIZE; I’ve just added that today. The flag is called ShaderAttrib.F_shader_point_size. Here is a little program showing how to enable it.

from panda3d.core import *
from direct.directbase import DirectStart

# Load a model, any model, create two instances
p = loader.loadModel("panda")

# Just turn its vertices into points
for node in p.findAllMatches("**/+GeomNode"):
    gnode = node.node()
    for i in range(gnode.getNumGeoms()):
        gnode.modifyGeom(i).makePointsInPlace()

p1 = p.copyTo(base.render)
p2 = p.copyTo(base.render)

p1.setX(-6)
p2.setX(6)


# Load a shader that sets the point size
shader = Shader.make(Shader.SL_GLSL, """


void main() {
  gl_Position = ftransform();
  gl_PointSize = gl_Vertex.z;
}""", """
void main() {
  gl_FragColor = vec4(1, 0, 0, 1);
}
""")


# Apply the shader, and the flag, to panda 1
attrib = ShaderAttrib.make(shader)
attrib = attrib.setFlag(ShaderAttrib.F_shader_point_size, True)
p1.setAttrib(attrib)

# Apply the shader with fixed point size to panda 2
attrib = ShaderAttrib.make(shader)
p2.setAttrib(attrib)
p2.setRenderModeThickness(5)


base.trackball.node().setPos(0, 80, 0)

base.run()

You’re awesome and no one blames you for not knowing everything! :smiley: