Skip to content

Limit buffer geometry updates #31338

Open
@trommlbomml

Description

@trommlbomml

Description

I am writing a game where i regulary update geometry buffers. Not every frame, from none, some and many buffers in the size of multiple thousand vertices.

To keep my update smooth I already update the attribute buffers until a maximum amount of time has passed and defer further updates to the next frame.

That works well up what I have not directly on my control is bufferData() calls for all dirty attributes in the buffer geometry. Threejs updates all dirty buffers, which can be so slow that I have regular spikes. It would be great if you can somehow control this from the outside to limit the buffer uploads per frame.

Solution

I see two options:

  1. Add a parameter to renderer.render(scene, camera) where I can pass a threshold in ms or buffer count. That limit tells to stop updating geometry uploads.
  2. Add a general parameter property to the renderer considered in all render calls.

Alternatives

I could also as a workaround only mark a maximum amount of my buffer instances with needsUpdate, but the measuring is much more accurate and a general framework task.

Additional context

As its an additional optimization parameter, it does not affect existing code and should have no impact on performance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions