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

Add heading option for a billboard #6165

Open
welchyd opened this issue Jan 26, 2018 · 11 comments
Open

Add heading option for a billboard #6165

welchyd opened this issue Jan 26, 2018 · 11 comments

Comments

@welchyd
Copy link

welchyd commented Jan 26, 2018

When I have a billboard with an image that is facing north, I can tilt the camera so the image is flipped. This is not what I would've expected, and there doesn't seem to be a way to keep the billboard's direction locked. Please fix.

Expected behavior - image pointing north:
screen shot 2018-01-26 at 12 56 30 pm

After a slight camera tilt, it then faces more southward:
screen shot 2018-01-26 at 12 56 51 pm

At a more extreme tilt, it seems to be pointing into the earth:
screen shot 2018-01-26 at 1 01 04 pm

I've been able to get it to happen in this workspace:
https://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=6f6710474236e3ffb99d41673e7b3632

@schmidtk
Copy link

schmidtk commented Jan 30, 2018

This is similar to the issue fixed in #2487, but I believe what's needed is a way to render the billboard parallel to the Earth. This was asked in the forum awhile back, and I haven't been able to find a solution either. Using an entity with a material to display the icon has the desired rotation effect, but doesn't maintain constant pixel dimensions like a billboard.

@hpinkos
Copy link
Contributor

hpinkos commented Jan 31, 2018

@welchyd the billboard is behaving as expected. The reason it seems to be flipping when you tilt the globe beyond a certain point is because the Z axis is now pointing down in screen space (ie the north pole is below the south pole) so the billboard rotates so it continues to point along the positive Z axis.

It seems like what you want is to set heading: 0 for the billboard. We don't currently have that option, but I'll re-label this issue for us to consider adding it.

@hpinkos hpinkos changed the title Billboard changes orientation/direction from North to South when camera tilted Add heading option for a billboard Jan 31, 2018
@welchyd
Copy link
Author

welchyd commented Jan 31, 2018

A heading would be awesome! Thanks @hpinkos
I did try working around this by drawing the icon as a material on a rectangle geometry, but that doesn't really scale with zoom nicely. Would love to see this added to the Billboard!

@esparano
Copy link

esparano commented May 15, 2018

There is a related problem where the "aligned axis" does not work as expected, and billboards that are near the edges of the screen behave as if their rotations are calculated from the center of the screen.

For example, we have a grid of billboards whose alignedAxes are tangent to the Earth's surface, pointing north, with 0 rotation:
image

While it looks fine or "close enough" at some angles, at other angles the billboards are not rendered correctly. The camera is pointed south in the following picture:
image
One would expect the billboards to the right (west) to point down-right, and the billboards to the left (east) to point down-left.

There is a problem in the BillboardCollection shader where the billboards near the center of the screen are rendered correctly, and all other billboards render as if they are at the center of the screen. You can see what I mean by the "red circle" on the previous picture. IF the billboards were all located at the center of the screen, their orientations would be correct.

I want to emphasize that this is different from a heading option for billboards and is a bug in the rendering based on the alignedAxis/rotation. The BillboardCollection shader code does not take screen location of the billboard into account.

@hpinkos
Copy link
Contributor

hpinkos commented Jul 23, 2018

Also requested by @hieeyh in #6825

@himby
Copy link

himby commented Apr 8, 2021

Bumping this one. This feature would be really nice, I'm currently working on an app that shows ships moving around in different directions, and as a workaround I have created polygons instead. but as pointed out these don't scale. So to come around that problem i use PointGraphics instead when zooming out. Billboards with heading seems perfect for the job. I've tried to modify BillboardCollectionVS.glsl to force billboards to lay flat on the ground, but this shader is a bit complex and I'm currently struggling to adjust it to how I want. Could someone else give it a try please?

@MishkaRogachev
Copy link

Hi! Have same needs, but maybe it is better to have a new separated graphics for oriented SVGs using Cesium.HeadingPitchRoll?

image

@abigstupidbear
Copy link

now do you have any solution to solve it??

@sersanchus
Copy link

I faced this exactly problem and I come to this sollution, see if that suites you too. It's based on updating the rotation of the billoboard acording to camera's actual heading.

const self = this;

style.billboard.rotation = new Cesium.CallbackProperty(function (time, result) {
    return self.map.scene.camera.heading;
}, false);

@ellmatt
Copy link

ellmatt commented Nov 10, 2023

I faced the same issue recently and came up with the following approach to solve this problem in sandcastle.
Sandcastle

@xyjwyq
Copy link

xyjwyq commented Nov 26, 2024

I faced the same issue recently and came up with the following approach to solve this problem in sandcastle. Sandcastle

when refPos get undefined,the direction is error, do you have any solution to solve it??

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

10 participants