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

Imagery Layers Split has IDL issues in 2D #5106

Closed
gongzk opened this issue Mar 15, 2017 · 7 comments
Closed

Imagery Layers Split has IDL issues in 2D #5106

gongzk opened this issue Mar 15, 2017 · 7 comments

Comments

@gongzk
Copy link

gongzk commented Mar 15, 2017

http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Imagery%20Layers%20Split.html&label=Showcases

If you scroll the 2D map so the IDL is in the center of the screen, the split imagery no longer lines up with the screen divider

@hpinkos
Copy link
Contributor

hpinkos commented Mar 15, 2017

Hello @gongzk, the demo worked fine for me in 2D. What OS and browser are you using?

@gongzk
Copy link
Author

gongzk commented Mar 16, 2017 via email

@hpinkos hpinkos changed the title Imagery Layers Split is not right work in 2D Imagery Layers Split has IDL issues Mar 16, 2017
@hpinkos hpinkos changed the title Imagery Layers Split has IDL issues Imagery Layers Split has IDL issues in 2D Mar 16, 2017
@hpinkos
Copy link
Contributor

hpinkos commented Mar 16, 2017

Ah, thank you @gongzk. I updated the comment for this issue. The layer splitter seems to have trouble with the international date line, which is where we stitch the 2D map together for infinite scrolling

@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 18, 2017

@jasonbeverage if you have time, this one could be of interest to you.

@jasonbeverage
Copy link
Contributor

I see that. I didn't realize that the 2D view did this multiple viewport infinite scrolling thing :) On first glance it looks like you might be able to adjust the imagerySplitPosition in execute2DViewportCommands based on the offset before you actually execute the commands.

@jasonbeverage
Copy link
Contributor

@pjcozzi the issue is that I'm using the width of the viewport to scale the imagerySplitPosition to fragment coords. This assumes that the viewport width is always the same width as the full canvas. This is the offending line:
https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/GlobeFS.glsl#L102

If I change the czm_viewport.z to be the hardcoded width of the canvas in the sandcastle example (1135.0 for me) then it works correctly in all cases that I can see.

A couple of ways to fix this:

  1. Require that imagerySplitPosition is in absolute coordinates and just use it directly.
  2. Have two different split positions in UniformState. A relative 0 to 1 that is settable and a computed one that feeds the actual uniform value based on the relative one and the canvas width.
  3. Pass a uniform with the canvas width to the GlobeFS shader.

I'm more of a fan of 1, what do you think?

pjcozzi added a commit that referenced this issue Mar 27, 2017
Made czm_imagerySplitPosition use absolute coordinates.  Fixes #5106.
@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 27, 2017

Thanks again for the report, @gongzk!

Fixed in #5151 by @jasonbeverage.

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

Successfully merging a pull request may close this issue.

4 participants