Merge buffergeometry question

Hi all.

on question.

I have a Object3D with Meshes, LineSegments and Points inside. For example:

  • Mesh_1
  • Mesh_n
  • LineSegments_1
  • LineSegments_n
  • Points_1
  • Points_n

I want to merge all these BufferGeometries in only one. The problem is when I try to render the final Merged Mesh (with the merged Geometries), the lines and Points are not properly represented.

So in my solution the minimal Object3D contains at least 1 object type of each (Mesh, LineSegments, Points). I guess that it is impossible to integrate Lines and Points in a THREE.Mesh, isn’t it?

Many thanks in advanced.

Best regards

This isn’t possible, no. You’ll want to join meshes with meshes, lines with lines, etc. Also note that merged geometries usually share a material, and lines and points use different material types.

1 Like

I want to merge lines with points and meshes in 1 only buffer geometry and finaly ony have 1 mesh with only 1 merged buffergeometry which contains the buffergeometry info of my lines,points and meshes.
I thought that as Meshes only show triangles they are not good to represent points neither lines.
My idea is to identify each vertex with an attribute which will say to the shader if belongs to a mesh line or point.

That isn’t possible – Each GPU draw call may only use one primitive type. You could write a custom shader to use all triangles but imitate having points and lines, I suppose, but that’s quite advanced and will prevent you from using threejs’s own material types.

1 Like

My apprach was the following:

Create each line as a triangle composed by the triple (vertexA,vertexB,vertexA) and for points (vertexA,vertexA,vertexA), but I don’t know if this is feasible or not.

Best regards