LineSystem - updating size without creating a new mesh


I’m trying to update an existing line system with new data. If the underlying GPU buffer sizes are kept the same, everything works perfectly; but that is not the case when the size is different.

Please refer to the following PG: Babylon.js Playground
I draw a square shape composed of 4 segments, then I try to update it to a 6 segment shape with modified corners.

I have absolutely no clue on how to achieve this without disposing the old line system and replacing it with a newly created instance. I’d highly like to avoid this because in my application a lot of observers/observables are already watching the current instance, such that I’d rather not link everything again on each geometry update.

Thanks a lot for helping me :slight_smile:

PS: I’ve tried this Updating Vertices | Babylon.js Documentation
and the “instance” option in the CreateLineSystem method already, without success.

1 Like

Hello! Adding more vertices to instance is indeed not supported BABYLON | Babylon.js Documentation ( If you don’t want to create a new system, maybe you can create a system with more vertices than initially needed and just update them as you go :slight_smile:


Oh it is not supported at all? That explains everything then, thank you for pointing it out :wink:
By the way, do you see a reason why? I mean I’ve done WebGL-based graphics engines, and this has never been a limitation, for instance using buffer orphaning. I’m just curious here :slight_smile:

1 Like

I think it’s just to avoid having to pass more vertex data to the GPU and just update what’s there :thinking: @Deltakosh is that correct?

Yep the goal is to be as frugal as possible. In this case we would have to rebuild the Vertex Array Object that can cause massive perf hits

1 Like