CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13k stars 3.5k forks source link

Add asynchronous hint to entities #5127

Open shunter opened 7 years ago

shunter commented 7 years ago

This issue has been discussed many times, but I couldn't find an issue for it, so filing this for reference.

In many cases, using the entity layer to create geometry produces bad results, because all non-time varying geometry is created asynchronously, causing significant latency when updating due to the enormous overhead of the web workers.

Our current recommendation is to use CallbackProperty to work around this bug, (see related #4791) but this workaround has significant performance penalty - the callback is run every frame, and the updaters are built expecting the values to change every frame. For truly time-varying properties, this is desirable, but in many cases, the value doesn't vary with simulation time, but does change at unknown or unpredictable times - through user input perhaps, or via updates from a server. In these cases, the definitionChanged event approach used by ConstantProperty is the right approach for efficiency.

The real solution would be to provide a hint to declare that a particular graphics should always be created synchronously. Then the natural and obvious approach of simply assigning new values would work as expected.

EKoetsjarjan commented 6 years ago

Hi I'm new at cesium.

I'm using the ConstantProperty to update the value is set value is used. how to do it using definitionChanged?

My updating works like this:

var trailwall = { wall : { positions: [], material : Cesium.Color.RED.withAlpha(0.5), } } var trail = datasource.entities.add(trailwall);

// ... then inside a tick method

trail.wall.positions.setValue(newpositions(time))

hpinkos commented 6 years ago

@EKoetsjarjan I'm sorry, I don't understand your question. Please ask this question on the forum instead: https://groups.google.com/forum/?hl=en#!forum/cesium-dev

We use GitHub exclusively for tracking bugs and planning new features. A lot more people are on the forum, and your post might help someone else who has the same question. Members of our team also monitor the forum to make sure all questions get answered. Thanks!

EKoetsjarjan commented 6 years ago

ok thank you

OmarShehata commented 5 years ago

I'd like to :+1: this, since it comes up so often, and even our own Sandcastle examples struggle with this. The drawing on terrain Sandcastle uses a CallbackProperty when drawing so it's smooth, but when switches to a static entity when done, which causes a very noticable flicker while the entity is being created asynchronously:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Drawing%20on%20Terrain.html

Being able to say "I'd like this entity to be created synchronously if possible" would fix this.

ggetz commented 1 year ago

This came up in https://github.com/CesiumGS/cesium/issues/11315 in regards to requestRenderMode. The user would like the ability to perform value updates, but would still like the ability to not have to render every frame and evaluate the callback.

Fedec96 commented 4 months ago

Any updates on the matter? Really interested on this one.

ggetz commented 4 months ago

@Fedec96 There hasn't been any activity on this recently.

If you'd like to add more information about your use case, that may help us prioritize. If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR. Thanks!

Fedec96 commented 4 months ago

@ggetz Hi Gabby, thanks for confirming. I'm not even sure the issue I'm having is related, so I'll post a separate issue which maybe can help others. :)