CesiumGS / CesiumGS/cesium

SDF label pixel ratio inconsistency

Open
#8,376 0 comments 0 reactions 0 assignees View on GitHub
category - labels type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Discussion started here: https://github.com/AnalyticalGraphicsInc/cesium/pull/8351#issuecomment-550308173

The SDF label looks different at 1.0 vs 2.0 pixel ratio:

none1
none2

But with a `czm_pixelRatio` "fix" in `BillboardCollectionFS.glsl`, they look the same:
both2
both1

However, this removes the crispness on normal labels:
1.0 PR:
Screen Shot 2019-11-07 at 9 48 00 AM
2.0 PR
Screen Shot 2019-11-07 at 9 47 31 AM
2.0 PR with `pixelRatio` "fix"
Screen Shot 2019-11-07 at 9 48 07 AM

I'm not sure which of these approaches to use. The underlying problem is shader derivatives. The smoothing is based off the `fwidth` of the texture's distance value and the sample offset is based of the `dFdx` and `dFdy` of the texture coordinates. For `pixelRatio` 2.0 these values are effectively half of `pixelRatio` 1.0, resulting in the cripser image. Might require a deeper dive into SDF labels at some point.

Contributor guide

Open the contributing guide

Research direction

Start in BillboardCollectionFS.glsl and review the SDF label shader's fwidth, dFdx, and dFdy handling across pixel ratios. Compare the reported normal and SDF label results at 1.0 and 2.0 pixel ratios. Done means the labels remain visually consistent without losing the crispness of normal labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.