Points not rendered

Hello everyone,

i am trying to render points using a geometry shader to generate vertex positions and normals for a voxel viewer.

I hit a snag : it seems that my shader is not being compiled (though i am sure it is being read since i get errors if i remove the #version line) and nothing is rendered even with “view-frustum-cull 0” in the prc.

No Exceptions, warnings whatsoever :confused:

Here’s some code :

# the format
dataFormatArray = GeomVertexArrayFormat()
dataFormatArray.addColumn(BLOC_COLUMN_NAME, 1, GeomEnums.NT_int8, GeomEnums.CPoint)
dataFormat = GeomVertexFormat()
dataFormat = GeomVertexFormat.registerFormat(dataFormat)

# the non-compiled shader
shader = Shader.load(Shader.SL_GLSL, vertex="voxel.vert", fragment="voxel.frag", geometry="voxel.geom")

# creating the Geom Node
data = GeomVertexData('Chunk', dataFormat, GeomEnums.UHDynamic)
blockwriter = GeomVertexWriter(data, BLOC_COL_NAME)
for b in chunk.blocks:
geom = Geom(data)
node = GeomNode('gnode')

# final touches (set shader, reparent to render)
path = NodePath(node)

I could add the shader to the post, but i don’t think that’s where the problem lies. I tried adding a GeomPoints object like in this issue, no dice.

Hi, welcome to the forums!

What jumps out immediately is that there is no ‘vertex’ column from which Panda can generate a bounding volume, so it has no way of knowing whether the object is in view or not.

You should remedy this by adding your own bounding volume to the Geom, or attaching an OmniBoundingVolume() to ensure that it is always being rendered.

Furthermore, it’s a little odd that you are using the CPoint mode, which should probably be CIndex?

Wow thanks for the fast reply :slight_smile:

About the bounding volume, shouldn’t disabling the frustum-culling take care of that ?

I am not sure about either CIndex or CPoint…

The column i use is just a uint8 that encodes the type of the cube rendered ; its position is set by the geometry shader based on the gl_VertexID, so it’s not really either.

Edit : i tried both adding an OmniBoundingVolume and setting CIndex ; it still does not work

Not sure why I didn’t notice this earlier, but you don’t have a GeomPrimitive added to your Geom. This is needed to actually make the draw call; just having the vertex data present is not enough, since Panda doesn’t know the layout and type of the primitives you’re trying to render.

You could create a GeomPoints, and just do addNextVertices(Chunk.CHUNK_SIZE), then add it to the Geom.

I’ve never been happier to see glsl errors :joy:

Thank you very much !