Skip to content

Refactor animated PLY sequence playback with in-place frame swapping#925

Merged
slimbuck merged 8 commits into
playcanvas:mainfrom
slimbuck:anim-dev
Jun 24, 2026
Merged

Refactor animated PLY sequence playback with in-place frame swapping#925
slimbuck merged 8 commits into
playcanvas:mainfrom
slimbuck:anim-dev

Conversation

@slimbuck

Copy link
Copy Markdown
Member

Reworks how animated PLY sequences are played back on the timeline. Previously each frame recreated the entire Splat element (destroy + reload), so any transform applied to the model was lost on every frame change, and once the scene had been edited, scrubbing popped a "reset scene" prompt that wiped the user's work.

A sequence is now a single persistent Splat element whose gaussian data is swapped in place per frame, so the whole-model transform and visual properties persist across frames and there's no reset prompt.

Changes:

  • Add src/sequence.ts: a generalized sequence manager with a FrameSource interface and PlyFrameSource, owning one persistent Splat and driving it from the timeline. Replaces src/ply-sequence.ts (removed).
  • splat.ts: extract bindAsset; add replaceData, which binds a frame's data onto a fresh entity that carries the current transform and keeps the previous frame on screen until the new one renders (no flicker). Fires splat.replaced.
  • splat-overlay.ts: re-attach the centers overlay on splat.replaced so it follows frame swaps instead of being torn down with the old entity.
  • asset-loader.ts: add createGSplatAsset to wrap decoded GSplatData into a gsplat asset.
  • main.ts / file-handler.ts: register the sequence manager and route PLY sequences through it.

Timeline scrubbing/playback and video export (plysequence.setFrameAsync) are preserved.

@slimbuck slimbuck requested a review from Copilot June 23, 2026 17:49
@slimbuck slimbuck self-assigned this Jun 23, 2026
@slimbuck slimbuck added the enhancement New feature label Jun 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors animated PLY sequence playback so a sequence is represented by a single persistent Splat whose Gaussian data is swapped in-place per frame, preserving user-applied transforms/properties and avoiding the prior “reset scene” workflow.

Changes:

  • Introduces src/sequence.ts to manage sequence frame sources and drive a persistent Splat via Splat.replaceData (replacing the removed src/ply-sequence.ts).
  • Adds Splat.bindAsset/Splat.replaceData to support in-place frame swaps with a one-frame overlap to avoid flicker and fires splat.replaced.
  • Updates overlay and file routing so the centers overlay reattaches after swaps and PLY sequences are routed through the new sequence manager.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/splat.ts Refactors initial asset binding and adds replaceData for in-place frame swaps on a persistent element.
src/splat-overlay.ts Listens for splat.replaced to reattach overlay after the underlying entity/instance is swapped.
src/sequence.ts Adds generalized sequence playback with FrameSource + PlyFrameSource and preserves plysequence.setFrameAsync for video rendering.
src/ply-sequence.ts Removes the old per-frame import/destroy-based playback implementation.
src/main.ts Registers the new sequence events instead of the removed ply-sequence events.
src/file-handler.ts Routes PLY sequence drops/opens to sequence.setPlyFrames.
src/asset-loader.ts Extracts createGSplatAsset helper for wrapping decoded GSplatData into an engine asset/resource.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/splat.ts
Comment thread src/splat.ts Outdated
Comment thread src/splat.ts Outdated
Comment thread src/sequence.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread src/sequence.ts
Comment thread src/sequence.ts
Comment thread src/splat.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/splat.ts:291

  • Splat.destroy() doesn’t release GPU resources created in bindAsset/constructor (stateTexture, transformTexture, transformPalette texture). This can leak GPU memory when splats are removed/scene cleared (and is especially noticeable with sequences that create many per-frame textures over time). Add explicit destroys before removing/unloading the asset.
        super.destroy();
        this.entity.destroy();
        this.asset.registry.remove(this.asset);
        this.asset.unload();

Comment thread src/sequence.ts
Comment thread src/sequence.ts
Comment thread src/splat-overlay.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@slimbuck slimbuck marked this pull request as ready for review June 24, 2026 10:45
@slimbuck slimbuck requested a review from a team June 24, 2026 10:45
@slimbuck slimbuck merged commit 8f7afeb into playcanvas:main Jun 24, 2026
2 checks passed
@slimbuck slimbuck deleted the anim-dev branch June 24, 2026 10:45
dimitribarbot added a commit to dimitribarbot/supersplat that referenced this pull request Jun 26, 2026
Brings in the animated PLY sequence refactor (playcanvas#925, ply-sequence -> sequence)
and the 2.28.0 release. Resolved src/main.ts: kept the fork's off-limits /
portals / portals-runtime registrations and dropped the removed
registerPlySequenceEvents import (the rest of the refactor auto-merged).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants