Repository navigation
Conversation
A circle marker is a vectorized glyph mesh of 60 to 104 vertices, about 4,160 bytes in the vertex buffers. With scene.markerrender set to disc or auto, circle and circle-open markers draw as one gl.POINTS vertex with a round cutout in the fragment shader, with an outline ring for marker.line.width. Other symbols, projections on the axes and sprites larger than the point size limit keep the glyph path. The default is glyph, so rendering does not change unless the attribute is set. gl-scatter3d is pinned to a fork commit, and stackgl_modules/index.js is rebuilt from it.
The value disc draws a glyph where a disc cannot draw the marker, and auto is the same as disc for now. The first description left both out.
The next commits call drawStride, drawRange and lodCount of regl-scatter2d. No release has these calls. The pinned commit holds them on top of the typed positions of the base branch, with a built bundle.js and no build script, so npm installs it without a build. A regl-scatter2d release replaces this pin.
A restyle of visible does a calc of every trace and an upload of every point. An application that hides one group of a large plot needs a faster path. scene.hidden[i] removes the markers of trace i from each draw. scene.setHidden(map) sets entries and draws again, without a calc or an upload. scene.visibleCount[i] replaces the point count of a trace for a caller that counts visible points. Each calc empties the two arrays.
One full draw of tens of millions of points takes the GPU 0.3 s to 0.7 s. Each open, edit and pan frame waits for that draw. With layout.lod.minpoints set, a draw shows every k-th point first. The full picture follows layout.lod.settle ms after the last draw request, in parts of layout.lod.slice points. A timer query paces the parts, so a new draw request waits for one part only. A copy of the preview covers the canvas until the last part. An edit of a fully drawn plot keeps the old full picture on screen until the new one is ready, in state stale. layout.lod.edits: 'preview' gives edits the preview. The graph emits plotly_lod on each change of state. Without layout.lod the draw calls and _fullLayout do not change.
Each frame of a rotation draws every scatter3d marker, and draws every marker again for the pick buffer. With scene.lod.minpoints set, a frame with a changed view draws every k-th disc marker and no pick pass. The scene draws every marker scene.lod.settle ms after the last change of the view, and the pick pass follows. scene.getLOD() returns the state, and the graph emits plotly_lod. stackgl_modules/package.json pins gl-plot3d and gl-scatter3d to the fork commits of the two package pull requests. stackgl_modules/index.js is the webpack output of that install. A static scene gets no level of detail.
npm run schema wrote test/plot-schema.json and src/types/generated/schema.d.ts.
The level of detail commit carried an older wording of the scene.markerrender description. That text belongs to the disc marker change. This commit puts the description of the base branch back, with the schema output of npm run schema.
The other draftlog files start with the dash.
A preview of every k-th marker had one k-th of the cover of the full picture, so faint markers all but vanished in it. A marker of alpha a that stands for k markers now gets the alpha 1 - (1 - a)^k. This is exact where the k markers cover the same pixels, and an estimate elsewhere. A marker of alpha 1 does not change. The change is in the two packages: this commit moves the pins of regl-scatter2d and gl-scatter3d, holds the webpack output for stackgl_modules, and adds one spec for scattergl and one for scatter3d.
This was referenced Dec 5, 2026
virtual-webgl returns an object with constants and no functions for an extension that it does not wrap, also when the context has no such extension. The level of detail tested only that the object exists, and then threw in the timer that draws the full picture in parts. The full picture never came. The extension now counts as missing unless createQueryEXT and getQueryObjectEXT are functions, and the plot waits with readPixels after each part. One spec passes such an object to the scene. The spec was not run on this machine before the commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
layout.loddraws every k-th point of a largescatterglplot first. The full picture follows when the plot is at rest.scene.loddoes the same forscatter3ddiscs while the camera moves. At 20 million points, a pan frame takes 5.4 ms instead of 114 ms. Without the two attributes, no pixel changes.Screencast frames in time order: the same scripted drag over 20 million points on
mainand withlayout.lod, 900x600. The ring marks the pointer. The times in this text come from separate measurement runs.One full draw of 20 million points takes the GPU about 0.1 s (114 ms per pan frame on this branch without
layout.lod). Each open, edit and pan frame waits for that draw.Plotly.reactof 50 million points on this branch, without and withlayout.lod. Five moments of a screencast in time order. Each panel shows the state of that moment, drawn with visible axes.The same graph and axes. The preview draws 781,250 of the 50 million points. At rest, 64 times more points fill the edge of each cluster.
A draw shows every k-th point, and k keeps the count within
budget. Aftersettlems without a draw request, the full picture follows in parts ofslicepoints. A pan between two parts waits for one part only. A recolor of a full plot keeps the old picture until the new picture is ready. Theplotly_lodevent reports each state.mainand this branch as strict bundles, one run each, Apple M3 Max. Preset:minpoints1M,budget1M,maxstride64,settle150 ms. The dashed line is this branch withoutlayout.lod, which holds #9.layout.lodThe full picture comes later with
layout.lod, because the full draw startssettlems after the last draw request. With 50 million points, the first frame comes after 245 ms instead of 740 ms. The full picture comes after 885 ms instead of 741 ms. In 3D, the full picture also waits for the end of the camera glide of the open. With 5 million discs, that is 786 ms instead of 491 ms.AnnZarro draws millions of single cells with plotly.js and needs this. Overview: #11.
Changes
src/traces/scattergl/lod.ts(new): the states aroundscene.drawlayout.lod:minpoints,budget,maxstride,settle,sliceandeditsscene.lodfor gl3d:minpoints,budget,maxstrideandsettlescene.hiddenandscene.setHiddenon the scattergl scene: hide traces without a calc or an uploadTesting
scattergl_lod: 24 specs.gl3d_lod: 6 specs.lodunset, 13 2D scenes and 8 3D scenes render the same pixels asmainlodset, the picture at rest equals the picture without it in 7 2D scenes and 8 3D scenesNotes
scattergltraces. Other WebGL traces or a selection turn the preview off.layout.lod.plotly_afterplotfires after the preview. For the full picture, wait forplotly_lodwith statefull.layout.lod. It takes 182 ms against 120 ms at 20 million points, and 455 ms against 266 ms at 50 million. The edit keeps the old picture on screen and draws the new picture in parts.aat stride k gets the alpha1 - (1 - a)^k. A translucent preview is thus as dense as the full picture. This is an estimate: it holds where the markers left out lie like the markers kept. A scattergl trace with markers of different alpha takes their mean.scene.hiddenandscene.setHiddenare members of an internal object. I can change them to a public form.gl3d_lodspec needs a change. The full frame then draws no pick pass before a pointer query. The change is ready.I can split, reshape or drop any part. Thank you for your time.
Checklist
ready-for-prlabel, and it has no assignee or lists me as an assigneemainin my forkdist/package-lock.jsononly for a dependency changedraftlogs/as draftlogs/README.md describes, or I will add one after the pull request opens