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

Support for animated billboards #2319

Open
mramato opened this issue Dec 11, 2014 · 14 comments
Open

Support for animated billboards #2319

mramato opened this issue Dec 11, 2014 · 14 comments

Comments

@mramato
Copy link
Contributor

mramato commented Dec 11, 2014

Animated billboards has come up numerous times on the mailing list, most recently here: https://groups.google.com/d/msg/cesium-dev/Qd_LRhmlb50/j-_rdsVUK4IJ I don't expect this to happen anytime soon, but since we didn't have an issue for it; I figured I'd create one.

Me and @shunter have some ideas on how to do this within the existing BillboardCollection architecture, it would basically involve an internal list of images/canvases/etc.. that need to be re-uploaded to the same spot in the text coordinates each frame. There's a chance that the ultimate answer is we need something other than a Billboard to do this, but it seems like a reasonable extension of the existing primitive.

EDIT: Better thread with use case: https://groups.google.com/d/msg/cesium-dev/cF9Vt28Wk-4/nJ68p3YONKcJ

@shunter
Copy link
Contributor

shunter commented Dec 11, 2014

Another thought I've had is that it might be reasonable to make the private TextureAtlas use reference counting, so essentially when a billboard changes its image, it would release its ref to the previous location, which could allow that location in the atlas to be reused for new textures.

@mramato
Copy link
Contributor Author

mramato commented Dec 11, 2014

Makes sense. We could also compact the atlas every so often if there are lots of unused textures. This way if someone is dynamically drawing with a canvas, it throws away old snapshots.

@shunter
Copy link
Contributor

shunter commented Dec 11, 2014

Yes, although you get re-use for "free" without compacting if you release the old ref before adding the new one, because it will re-use that location immediately (assuming the same size, and that no other billboard in the collection has a ref to the old snapshot)

@mramato mramato self-assigned this Feb 4, 2015
@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 15, 2015

Related forum discussion: https://groups.google.com/forum/#!topic/cesium-dev/JzpfPUvBdEA

@ggetz
Copy link
Contributor

ggetz commented May 11, 2018

@mramato
Copy link
Contributor Author

mramato commented May 11, 2018

I have an old implementation of this which uses animated gifs (but really as long as you have the frames it works). It's an Entity API-level solution, but that kind of makes the most sense anyway. I'll see if I can dig up the code and post it here, might be a good PR for someone else to finish up if I can't find the time.

@ggetz
Copy link
Contributor

ggetz commented Aug 10, 2018

@mramato Do you have your gif implementation still? It was requested on the forum: https://groups.google.com/forum/#!topic/cesium-dev/Qd_LRhmlb50

@mramato
Copy link
Contributor Author

mramato commented Aug 10, 2018

it's the animated-billboards branch, but it's really just one new file in a helper class called BillboardAnimator that you can see here: https://github.com/AnalyticalGraphicsInc/cesium/compare/animated-billboards

It's been a while, but I think you use it like this:

var animator = BillboardAnimator.fromGif({url: url});
entity.billboard.image = animator.image;
entity.billboard.imageSubRegion = animator.imageSubRegion

As you can tell, I never finished it so the usability is a little quirky, but it works really well. Here's a live demo http://mramato.github.io/Demos/AnimatedBillboards/index.html (the imagery doesn't load because ancient version of Cesium)

@OmarShehata
Copy link
Contributor

@OmarShehata
Copy link
Contributor

@TannerBragg
Copy link

TannerBragg commented Sep 12, 2019

We definitely have a need for this feature. I work on an app that is fed a CZML data source with real time data. We feed SVG Data URI to billboards to track objects. The data uri is generated using https://spatialillusions.com/milsymbol/ library. I should also clarify the data uri is generated by a nodejs service on the back end which is then kicked up to the front end in a CZML data stream. I can break cesium in as little as two minutes with a small set of our data. :( The edit forum thread on the OP describes our problem exactly.

Finally, when we update the entity's billboard with a new data uri, we are left with an unpleasant flickering/flashing of the image when the new image is loaded. It would be very nice if there was a double buffering feature where the image appeared to "move" when updated and redrawn.

@markerikson
Copy link
Contributor

I wrote the second Groups thread, 5 years ago. Still working on the same app, with the same workaround in place. This would be extremely beneficial to have.

@ggetz
Copy link
Contributor

ggetz commented Oct 18, 2023

In #11569, @syzdev noted jitters that can occur with larger images when updating subregions of billboards.

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

8 participants