Skip to content

Viewport culling causes incorrect filter rendering at edges #1304

@grebmeg

Description

@grebmeg

Filter effects (blur, drop shadow) render incorrectly when filtered elements are near or extend beyond viewport boundaries. Filters operate on incomplete data because geometry is culled before filter expansion is calculated.

Image

Culling happens too early in the pipeline:

  • make_tiles — Culls geometry to viewport, casting f32u16
  • Filter expansion calculated in pop_layer() — After culling

Coordinates are unsigned u16, cannot represent negative values or pre-expand viewport:

pub struct Strip {
    pub x: u16,
    pub y: u16,
}
pub struct Tile {
    pub x: u16,
    pub y: u16,
}

Proposed Solutions:

  • Option 1: Negative Coordinates: change all coordinates from u16 to i16.
    • Cons: massive refactor.
  • Option 2: Layer-Local Coordinates: render filtered layers in their own space starting from (0,0), then composite with offset.
    • Cons: coordinate mapping complexity; perf — If multiple elements in a layer extend beyond the viewport by different amounts, computing the final layer bbox becomes more complex, each element that expands the bounds might force bbox to grow, which in turn might shift element positions and requires making new tiling based on the updated coordinates.
  • Option 3: apply a fixed large offset to all geometry rendered in filtered layers, keeping u16 coordinates. Store the offset in the layer and apply the inverse during fine rasterization (compositing).
    • Cons: poor perf, complex logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cpuApplies to the vello_cpu crateC-sparse-stripsApplies to sparse strips variants of vello in general

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions