-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CARTO: Implement QuadbinHeatmapTileLayer #8703
Merged
Merged
Conversation
This file contains 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
felixpalmer
commented
Mar 25, 2024
donmccurdy
reviewed
Mar 26, 2024
felixpalmer
commented
Apr 17, 2024
@@ -44,7 +44,11 @@ export default class PostProcessEffect<ShaderPassT extends ShaderPass> implement | |||
} | |||
const clearCanvas = !renderToTarget || Boolean(params.clearCanvas); | |||
const moduleSettings = {}; | |||
moduleSettings[this.module.name] = this.props; | |||
const uniforms = this.module.passes[index].uniforms; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #8801
donmccurdy
approved these changes
Apr 17, 2024
Pessimistress
force-pushed
the
master
branch
4 times, most recently
from
April 25, 2024 03:09
0a083b6
to
eb85da3
Compare
felixpalmer
added a commit
that referenced
this pull request
Apr 29, 2024
This was referenced Jun 11, 2024
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.
Background
Implementation of custom layer for CARTO module to allow display of a
QuadbinTileLayer
as a heatmap. LIVE DEMOSome of the ideas used here might be interesting for discussion for inclusion in core, however this PR aims to implement the functionality with minimal changes required to code outside of
deck.gl/carto
. As such, there may be a cleaner way if we move some of the code to core (seePostProcessModifier
&OffscreenModifier
below).Screen.Recording.2024-03-25.at.14.47.44.mov
Implementation
Unlike the existing
HeatmapLayer
which renders points as 2D gaussians (essentially a blurred point) and then sums them, this layer performs the sum using a spatial index, and performs the blur in screen space. Both layers then apply a color map to the resulting value to give the familiar heatmap look.Offscreen rendering
In order to achieve the above effect it was necessary to apply a custom post process effect to a single layer, specifically a
CompositeLayer
, to allow the use of tiled data.A new set of helper functions is introduced to make it simpler to apply the postprocessing:
PostProcessModifier & OffscreenModifier
PostProcessModifer
modifies a layer to make it apply a given post process effect:For this to work, the non-composite layers that the
CompositeLayer
will draw will need to be rendered off-screen:This approach is conceptually related to the ColorFilterExtension RFC, but it is much more powerful, as it supports effects which sample nearby pixels, allowing for effects like blur, heatmap, edge-detection or any other kernel-based transformation. By contrast the ColorFilterExtension RFC only allows color filters.
Integration
QuadbinHeatmapTileLayer
is a drop-in replacement forQuadbinTileLayer
with a number of extra props added to control the heatmap:Change List
PostProcessModifier
&OffscreenModifier
helper functionsheatmap
shader moduleSolidPolygonLayer
to output correct screen-normalized value that theheatmap
shader module requiredclearTarget
option toPostProcessEffect
&ScreenPass
(only change required to core)