Is there a way to partially update a mesh vertex buffer or to split a vertex buffer into smaller ones? With mesh.updateVerticesData you have to pass the whole vertex buffer of any kind, even if you just need a few vertices to be changed.
With low vertex count meshes, this is done very fast and can be performed several times in a row without lagging, but when your meshes have a few thousands vertices, this is an issue for realtime performance in a particular project (that involves randomly moving a few vertices from a bigger mesh on each click or series of clicks).
I’ve tried to slice the whole mesh in smaller parts, and it gets better performance, but it will be better if there’s a solution that keeps the mesh as a whole and not split into pieces. That’s why I thought if there’s the possibility to update a small part of the whole buffer or if maybe is there a way to split the vertex buffer into smaller buffers (so you just need to update a smaller part).
Thanks @Deltakosh for pointing me to the right direction. I’ve managed to set up a simple system with this but I’ve found an issue: as sson as I call updateDirectly, the buffer data is cleared and I can not continue using it (after calling mesh.updateVerticesData it’s filled again, but the whole point in my case was to not use that method and just partially update the buffer).
Here I’ve set up a playground with this issue with the color buffer (take a look at the console output and line 58 and 74): https://playground.babylonjs.com/#37Z4FJ#1
Is there a workaround for this?
Thanks again for your support and keeping this awesome framework mantained
all the data are wiped as they are not synced anymore (Again, we don’t want to spend time on syncing things as maybe you are using one single big buffer for all your VBs)
So ideally you should get your own copy before updating the data in raw mode