Skip to content
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

Use CSS pixel units everywhere #8113

Closed
9 of 10 tasks
lilleyse opened this issue Aug 27, 2019 · 10 comments
Closed
9 of 10 tasks

Use CSS pixel units everywhere #8113

lilleyse opened this issue Aug 27, 2019 · 10 comments

Comments

@lilleyse
Copy link
Contributor

lilleyse commented Aug 27, 2019

  • Point cloud size
  • Styled point cloud size
  • Point cloud eye dome lighting radius
  • Polyline arrow
  • Polyline dash
  • Polyline shadow volume
  • GL line width
  • Model minimum pixel size
  • Star Burst demo
  • Frustum getPixelDimensions

#8083 changed Cesium to render at device resolution rather than upscaling on high DPI displays. The problem now is there are some options in Cesium whose unit is pixels but it's unclear if that means "CSS pixel" or "device pixel".

Everything should be in CSS pixels so that a scene doesn't look different on different displays. We should sweep through everything that has pixel units and multiply by frameState.pixelScale like we're doing for SSE.

For example point cloud maximum attenuation is considered to be "device pixels" and because of that points are smaller than in 1.60.

1.60 Sandcastle
old

master Local Sandcastle
new-unfixed

master with devicePixelRatio correction Local Sandcastle

new-fixed

@lilleyse
Copy link
Contributor Author

lilleyse commented Sep 3, 2019

A workaround is to set viewer.resolutionScale = 1.0 / window.devicePixelRatio.

This will render the Cesium canvas in CSS pixels rather than device pixels and will apply upscaling for high dpi devices. This is the behavior in 1.60 and before.

@chris-cooper
Copy link
Contributor

Are polylines on terrain already on your list @lilleyse ?

@lilleyse
Copy link
Contributor Author

@chris-cooper I haven't created a full list yet but that's a good one to add.

@smills2929
Copy link

A workaround is to set viewer.resolutionScale = 1.0 / window.devicePixelRatio.

This will render the Cesium canvas in CSS pixels rather than device pixels and will apply upscaling for high dpi devices. This is the behavior in 1.60 and before.

@lilleyse
It isn't quite so simple. If you set the viewer resolutionscale and then drag your browser window (with a cesium viewer in it) from a high DPI screen to a low DPI screen with different scaling, it doesn't adjust it, so you get a horribly pixelated viewer.

@OmarShehata
Copy link
Contributor

OmarShehata commented Sep 24, 2019

drag your browser window (with a cesium viewer in it) from a high DPI screen to a low DPI screen with different scaling

You should be able to detect this in your application, and you can re-update the resolution scale then. See https://stackoverflow.com/a/31482424

@lilleyse
Copy link
Contributor Author

@smills2929 also check out some of the solutions in #8083:

There was some discussion about making this a configurable option in cesium. I think there's enough demand now that it's worth doing. I opened an issue which we'll target for the coming release: #8215.

@lilleyse
Copy link
Contributor Author

@smills2929 you can now replace any workaround code with viewer.useBrowserRecommendedResolution = true. It will ship with Cesium 1.62.

@smills2929
Copy link

smills2929 commented Sep 26, 2019 via email

@lilleyse
Copy link
Contributor Author

@IanLilleyT since just the GL line width problem is left can you open a separate issue? This one can be closed.

@IanLilleyT
Copy link
Contributor

The separate GL lines issue can be found here: #8319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants