Can I use custom attributes for BufferGeometry?

I know there are the position, uv, attributes… but can I use custom ones?
If so, when merging geometry, will it retain the custom attributes and take those into consideration when merging?
My intent is that I have some vertices I want to track- so I need to know where they end up after merging… I was thinking I could add custom values to those, and then find the vertices after merge based on their values.


Yes, BufferGeometryUtils.mergeBufferGeometries() honors custom attributes.

I ran into an issue with BufferGeometryUtils.mergeVertices()
The attributes appear to be limited to an itemSize of 4. When I use an itemSize greater than 4, mergeVertices() produces errors.

If the limit of itemSize is 4, I think the documentation should say so. I don’t see it mentioned though, so I’m under the assumption you can use any itemSize.

TBH, three.js should not teach WebGL. You can’t have GLSL vector attributes with size greater than 4 since there is no vec5.


Data is stored as vectors of any length (defined by itemSize), and in general in the methods outlined below if passing in an index, this is automatically multiplied by the vector length.

Then the documentation is incorrect.
Anyways, I’ll have to keep this in mind.

Improving the docs here:

1 Like