Skip to content

[Bug] CollisionFilterExtension breaking on first render / resize #10333

@ldean43

Description

@ldean43

Description

On initial render, the CollisionFilterExtension hides all data when using MapboxOverlay with interleaved: false. Data is hidden till the next render.

I have traced this to being caused by a bad collision map in collision-filter-effect.ts. The deck canvas initializes with width: 300, height: 150 leading the initial FBO size to be width: 150, height: 75 after the downscale. After the CSS dynamically resizes the canvas, the FBO does resize but the needsRender flag in _render fails despite the FBO resize.

I have only really tested this using MapboxOverlay, but it seems to be in action on the current CollisionFilterExtension example in the docs.

Screen.Recording.2026-05-23.at.3.35.59.PM.mov

The behavior also seems to happen on canvas resize:

Screen.Recording.2026-05-23.at.3.38.07.PM.mov

I managed to fix this on my project by just adding these few lines to the for loop on collision-filter-effect.ts:85, but I don't know if this is the proper fix:

// Resize framebuffers to match canvas
for (const collisionGroup in channels) {
    const collisionFBO = this.collisionFBOs[collisionGroup];
    const lastWidth = collisionFBO.width;
    const lastHeight = collisionFBO.height;
    const renderInfo = channels[collisionGroup];
    // @ts-expect-error TODO - assuming WebGL context
    const [width, height] = device.canvasContext.getPixelSize();
    collisionFBO.resize({
        width: width / DOWNSCALE,
        height: height / DOWNSCALE
    });
    const fboSizeChanged = lastWidth !== width / DOWNSCALE || lastHeight !== height / DOWNSCALE;
    this._render(renderInfo, {
        effects,
        layerFilter,
        onViewportActive,
        views,
        viewport,
        viewportChanged: viewportChanged || fboSizeChanged
    });
}

Thank you for taking the time to take a look at the issue! I really love the project!

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CARTO
  • ArcGIS

Expected Behavior

Data items that aren't colliding should be visible on initial render / viewport resize. If they are colliding, the winner should at least be visible.

Steps to Reproduce

Codepen example using MapboxOverlay and ScatterplotLayer. Run the codepen and you'll notice that all scatters are hidden till you pan/zoom the map.

Environment

  • Framework version: deck.gl@9.3.1 (company project), deck.gl@9.3.2 (codepen)
  • Browser: Chrome Version 148.0.7778.179 (Official Build) (arm64)
  • OS: macOS 15.5 (24F74)

Logs

These are some logs I used to help find the issue:

collision-filter-effect.ts:87 [collision] test-isloated canvasSize: (2) [300, 150] fbo: 600 300
collision-filter-effect.ts:147 [collision-render] test-isloated needsRender: true viewportChanged: true fbo: 150 75
collision-filter-effect.ts:87 [collision] test-isloated canvasSize: (2) [1407, 1257] fbo: 150 75
collision-filter-effect.ts:147 [collision-render] test-isloated needsRender: false viewportChanged: undefined fbo: 703.5 628.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions