Native: truthful drawBuffersExtension cap and cheaper range-filtered splat sort fallback

Open
#19,145 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Read thinNativeEngine.pure.ts for the drawBuffersExtension capability and the Gaussian splatting mesh base code around the "Native sort can't filter ranges" fallback. Check how _activeSplatRangeKey tracks range changes, then verify the capability and unchanged-range behavior on Native runtimes with and without sortSplatIndices. Done means Native reports the actual multi-framebuffer capability and unchanged range sets avoid rebuilding and uploading the identity index array.

Written by the indexing model from the issue text.

Description

enhancement Gaussian Splatting native

Follow-up from review on #19144 (comments by @matthargett). Nothing here blocks #19144.

1. Make drawBuffersExtension truthful on Native

ThinNativeEngine reports drawBuffersExtension: true unconditionally (thinNativeEngine.pure.ts, caps). The real capability is _engine.createMultiFrameBuffer. On a runtime without it, _createNativeMultiFrameBuffer falls back to a framebuffer bound only to the first color target. A MultiRenderTarget, or the Gaussian splatting streaming atlas (_supportsRenderTargetAtlas), would then silently get only attachment 0: centers but no covariances or colors.

Proposed: drawBuffersExtension: !!this._engine.createMultiFrameBuffer, matching supportDepthStencilTexture a few lines below. Then _supportsRenderTargetAtlas can drop its Native special case.

2. Range-filtered splat sort fallback on older Native runtimes

With #19141 and BabylonNative's sortSplatIndices, range-filtered meshes (streaming compounds, hidden parts) are depth-sorted on Native. On runtimes that only expose sortSplats, gaussianSplattingMeshBase falls back to the range-filtered identity order (around the "Native sort can't filter ranges" comment). That has two costs:

  • the compound is drawn unsorted;
  • every sort request rebuilds the identity index array in a JS loop and calls thinInstanceBufferUpdated("splatIndex"), even though the result does not depend on the camera. That is an O(N) interpreter loop plus a 4-byte-per-splat upload per camera move.

Proposed: skip the rebuild and upload while the active range set is unchanged, since the range key is already tracked in _activeSplatRangeKey.

Related
  • The 0.29% Gaussian Splatting LOD COMPOUND threshold in #19144 should be re-measured once sortSplatIndices ships in a BabylonNative release, since the current number may reflect the unsorted fallback.
Dominant language
TypeScript
Stars
26.6k
Forks
3.8k
Avg merge
1d 9h
Merged PRs (30d)
112

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BabylonJS/Babylon.js

All issues in BabylonJS/Babylon.js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.