emilk / emilk/egui

PathShape rendering changed, rendering some paths incorrectly

Open
#7,294 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**
Rendering a filled closed stroked PathShape, when some points are closer than stroke width makes some fill triangles render on top of the stroke line.

This bug only exists after and including version 0.31.0 of eframe.

Before version 0.31.0, it wasn't trying to follow inner stroke border precisely, so in places where stroke line overlaps with itself, it wouldn't render fill overlapping it too.

**To Reproduce**
Render a closed PathShape with fill color set, points being
```
[
pos2(265.0, 109.0),
pos2(274.0, 112.0),
pos2(476.0, 347.0),
pos2(259.0, 340.0)
]
```
and stroke width of `30.0`.
Some fill triangles render on top of stroke triangles.

**Expected behavior**
Avoiding rendering fill triangles over stroke line.

**Screenshots**

version <0.31.0
![Image](https://github.com/user-attachments/assets/3012f006-88de-4b03-83cb-ea0d67bc0aa5)

version >=0.31.0
![Image](https://github.com/user-attachments/assets/4299fc4f-a781-4262-9f52-03320588d67b)

Contributor guide

Open the contributing guide

Research direction

Reproduce the closed PathShape case using the listed points, fill, and 30.0 stroke width, then trace the PathShape rendering and triangulation entry points while comparing behavior before and after eframe 0.31.0. Done means the reproduced path no longer draws fill triangles over the stroke, with a regression test covering the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.