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

SceneTransforms.wgs84ToWindowCoordinates incorrect when tracking entity #3247

Open
hpinkos opened this issue Nov 26, 2015 · 22 comments
Open

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Nov 26, 2015

Reported in the forum
https://groups.google.com/forum/#!topic/cesium-dev/XYAGd93UkmA

He included a really good example in the post.
SceneTransforms.wgs84ToWindowCoordinates returns the wrong window coordinates when the tracked entity has a different position from the one being converted to a window coordinate.

@jpremkumar
Copy link

Has there been any progress on this issue?

I would love to incorporate into my project.

@mailmrmanoj
Copy link

Hello All,Pls have a look at this issue..
Thanks

@vijquick
Copy link

vijquick commented Feb 5, 2016

+1
Any update on this issue please?
Thanks

@gantamk
Copy link

gantamk commented Feb 5, 2016

+1

1 similar comment
@batakpout
Copy link

+1

@svsachin13
Copy link

+1
can anyone take a look at this please?

@sagariEduri22
Copy link

I'm also facing the similar issue in my project.please update the progress on this issue.

@devidatta45
Copy link

+1
can anyone please help me on this..

@kankarsuresh
Copy link

+1
Thanks jpremkumar for such a good example

@swapna-devadict
Copy link

+1
facing the same issue, can anyone help on this please..
Thanks

@hpinkos
Copy link
Contributor Author

hpinkos commented Mar 10, 2016

@bagnell can you give @jpremkumar advice for fixing this issue?

@jpremkumar
Copy link

Hi @bagnell,

Based on the discussion I'd with @hpinkos, it looks like the problem could be related to "camera transformation".

Can you advice on how to proceed further?

@jpremkumar
Copy link

jpremkumar commented May 11, 2016

Any progress on this issue or anyone advice for fixing this issue please.

@mramato
Copy link
Contributor

mramato commented May 11, 2016

While I can't say exactly what the problem is, it's going to be related to the camera viewMatrix and transform properties. When tracking an object, the transform is something other than the identity, which means that at some point during the calculation, we probably need to transform the position to the proper reference frame.

I would recommend you see if this works in 2D when tracking and object, if it does, then most likely you need an else block after the if block on line 117 of SceneTransforms.js that handles 3D and CV and applies the camera transform to the input data.

If it doesn't work in 2D either, then you might need to always apply the transform.

There's a chance the problem is something else entirely, but that would be the best place to start. Sorry I can't be more specific (or else I would have fixed it myself already), you'll have to dig into the code and experiment.

Thanks.

@jpremkumar
Copy link

Thank you @mramato for the guidance. Let me experiment...

@jpremkumar
Copy link

jpremkumar commented May 12, 2016

I've spend good time with #3247. It looks like, tracking is not working in 2D mode as well. I've tried with different transformation on worldToClip (line no 68) and clipToGLWindowCoordinates (271) functions, but no luck :(

cesium_issue_v11
White text "Sample Popup" is the billboard.

branch: models-2D - Output
cesium_issue_v13

@emackey
Copy link
Contributor

emackey commented May 13, 2016

@jpremkumar forgive me if you already know this: HTML measures vertical coordinates starting at the top, increasing as you go down, like text. WebGL, like many graphics systems, places the origin in the lower-left, with vertical coordinates increasing as you go up the screen. From your screen cap, it looks like you just need to flip your Y coordinate. (Also beware that the canvas may be a different vertical resolution from CSS pixels in the DOM).

@jpremkumar
Copy link

jpremkumar commented May 17, 2016

@emackey, You are right, I've flipped the position of clip coordinates, before it convert to windows coordinates.

Source: SourceTransforms.js Line#191

positionCC.y = -(positionCC.y);

test111

The changes addressed the positioning but am not sure about the impact. Could someone assist in validating the fix?

@emackey
Copy link
Contributor

emackey commented May 18, 2016

@jpremkumar So it turns out we have a bug where the Y coordinate got flipped, written up as #3920. It's very likely the fix for #3920 will involve flipping it back the way it was.

@jpremkumar
Copy link

Thank you @emackey for the update.

@jpremkumar
Copy link

jpremkumar commented Jun 2, 2016

Hi @emackey, I've tested the bug #3247 with the latest Cesium version r1.22. Still facing the same positioning issue. The #3920 is not the fix for #3247. When I flip the Y coordinates in the SourceTransforms.js, then it works.

Source: SceneTransforms.js Line#191

positionCC.y = -(positionCC.y);

Can you assist on this please.

@eric-g-97477
Copy link

If it helps, I've updated the original sandcastle code from the forum. It was no longer working.

working sandcastle

pakb added a commit to geoadmin/web-mapviewer that referenced this issue Aug 18, 2023
this way it alleviate the issue raised by previous method here : CesiumGS/cesium#3247
We will have to make sure this works also with mobile
pakb added a commit to geoadmin/web-mapviewer that referenced this issue Aug 21, 2023
this way it alleviate the issue raised by previous method here : CesiumGS/cesium#3247
We will have to make sure this works also with mobile
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