Is it possible to bind one attribute to several buffers?
Or map attribute to pull from a buffer at different offset.
Allow me to explain my madness:
const posArray = instancedArray(count, 'vec3')
myInstanceMesh.instanceMatrix = //attribute that will pull posArray[0] into [12]
//position of the matrix, and likewise for every 16
basically an opposite of the interleaved buffer, instead of one buffer holding several attributes use one attribute from several buffers.
Equivalent to
for (let i = 0; i < count; i++)
posMatrix.array[i*16+12] = posArray[i*3]
except cleaner and more efficient. I understand that it would be smarter to use positionNode to manipulate verts directly, but there are reasons why I need it this way
AFAIK, it’s not possible! You’ll need to handle it manually, in your case you can create three parallel attributes for position, scale, and rotation. Then use Matrix.compose, Matrix.decompose to read, write to the matrix attribute.
That is unfortunate, as it feels like making a bottleneck
Wish there was a way to access StorageInstancedBufferAttribute.element() at some offset, but it always returns element at the current instance (is that a workgroup thing?)
Reassigning the position node messes up animations, I can’t find a way to do it without either baking them or having to write a huge chunk of code that will recalculate all bones during runtime (and that will again need the transform matrix from what I gathered).