Maximum number of groups on Instanced Buffer Geometry?

buffergeometry
geometry

#1

I’m having some issues with applying new textures to an instanced buffer geometry.
I create an instanced buffer geometry, copied from a PlaneBufferGeometry, currently with 6448 instances. I have different textures to be applied to the geometry so I create additional groups using addGroup.
However, the maximum number of groups I need is 1612 ( 6448 / 4), but only a single triangle of the plane geometry is being rendered. At 806 groups, the planes are rendered correctly with both triangles making up each plane being rendered.

So, I was wondering if there is some form of limit to how many groups there can be on a buffer or instanced buffer geometry? Or if not, then why would I be having the issue I am having as the number of groups increases?
Thanks.


#2

Hello Buster,

I don’t believe there is a total amount of groups/subs limit. The program may be maxing out memory ressources.

I am not too sure where groups come into play with instancedbuffergeometry though. When instancedbuffergeometry objects is used, Three.js creates 1 object for all instances. Then, each instance can be manipulated via attributes arrays, there exists no underlying objects for each instance you can add a group to.

Assuming there are not too many textures, 8 being the minimum guaranteed, you should be able to set/swap texture for each instance. To achieve such effect, you can create a texture reference attribute and store each texture reference to use in the fragment shader. Or better, you could have 1 texture and pass the proper UV offsets to the fragment shader via attributes.

GL &HF