I have a model, it’s vertices are grouped into a few groups, using a grey scale value. Can anyone think of a way to calculate the center point of each group of vertices, within a shader? If I was doing this on the CPU, I would say: for each group, add all the vert positions up, and divide this sum total by the vertexCount of the group. But I have no idea how this could be done on the GPU/in a shader.
The number of vertices in each group will stay constant. So I dont need to calculate that; it can be prebaked. However I still need to figure out how to get the position of each vertex in he group, and add them all up.