-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Entity primitive continuously re-drawn when position is SampledProperty #6631
Comments
Looks like |
I assume this is a trivial fix, but @bagnell can you confirm that there's no reason we should be calling |
This might be related, trying to get the Clipping Planes Sandcastle working with requestRenderMode doesn't really work because the entity has a PlaneGraphics with a Is this expected that CallbackProperties essentially break requestRenderMode (even if they're not returning different values?) If so, I think this could be worked around by not using a CallbackProperty and manually updating the property's value. @ggetz |
@OmarShehata this is how entities are designed to work when they're dynamic. The Entity API is really good at drawing things that are static, and things that are constantly changing, but it unfortunately doesn't handle updating things that change intermittently in the best way because it will always update every frame if any of the properties are not constant. |
I haven't looked at this since it was first filed. The last response before Omar's was Matt asking if the diagnosis was correct. Has the issue been fixed in the meantime? If not, can it get some attention? |
I understand that this is by design and it works in most cases. I do feel like for this situation it would be nice if as an application developer I could do something like Right now to get the Sandcastle to work I had to clone the Entity's position and re-set it to force it to update, but even then it doesn't trigger an update in the same frame.
Just to bump that question, @bagnell do you know if calling |
I have seen in the @thw0rted that this behavior doesn't happen in 3D scene, but in the example provided in #7943 the requestRenderMode is not working in the 3D scene when a CallbackProperty is used to update the entity vertices Why the Callback function is not only called when the scene.requestRender is called? |
I see this has been dormant for awhile. Perhaps it would possible to switch to the |
My team recently encountered this issue when using request render mode with entities whose position is a sampledPositionProperty. The goal of request render mode for us is to reduce the computer resources required when the clock is paused. However, this issue seems to cause the screen to continually update. Has any progress been made towards this? |
We have run into this too; is anyone looking at this issue and/or is there a workaround available? |
We're also having this problem. I'll dump what my understanding is so far. I am not 100% sure about this, so if anything is wrong, please correct me :) If you define a dynamic property of an Entity (e.g. CallbackProperty, but probably also SampledPositionProperty), it is marked as dynamic. A dynamic entity is updated every frame, because Cesium has no way of knowing if property values for the new frame will change. That's all fair.
and then re-created. If I've tracked the code correctly, this will cause the Primitive to re-initialize, which is probably the point where it calls At this point, I could see a potential fix in two directions:
|
Hey @ggetz I have a hunch that this is resolved if we change setReady() in Primitive.js to this:
instead of this:
Essentially, the primitive follows this lifecycle on a single frame/clock tick:
By setting primitive._ready immediately, there's no need to request another render which solves the infinite rendering problem reported on this issue. Do you see any reason why this solution would cause problems? |
I built a few more Sandcastles to test different cases. In all of these sandcastles, the expectation is that the Ellipse should only render when a renderRequest (button click) is explicitly made or the amount of time specified by maximumRenderTimeChange has elapsed. Instead, the scene constantly renders in all of them. Case 1: animation is paused, Infinity maximumRenderTimeChange
Case 2: animation is active, 2 second maximumRenderTimeChange
|
Update Primitive _ready flag immediately instead of on the next render. This resolves the infinite rendering loop caused by dynamic Primitives which was reported under CesiumGS#6631.
This original Sandcastle from this bug report is missing one important detail but once this line is added, my commit fixes the constant rendering issue:
The default maximum render time change is 0.0 so when debugging this Sandcastle with my fix (#11855) I noticed it continued to render constantly. However, I figured out this was because the time difference always greater than 0: Scene.js:L4030. Once I added the line above, all worked as expected. Maybe a better default value for viewer.scene.maximumRenderTimeChange would be Infinity? |
In fact, I truly hope if it could render when the entity's property value updated instead of never change until requestRender was called. |
Example in Sandcastle, based on the Interpolation demo.
Note that the debug frame counter shows continuous frames being drawn even though we're in requestRenderMode = true and the animation is paused. I found this because my app is rendering with a poor framerate in some cases, and I tracked it to a single rogue entity that has a SampledPositionProperty and an ellipsoid graphic. I dug in the debugger a little and figured out that for some reason, the associated primitive collection is being updated just about every frame, which didn't make sense to me as I wasn't modifying anything.
This doesn't happen in 3D scene mode, and it also doesn't happen with other 2D primitives (billboard, label, etc). I haven't tried with other solids but I'd be surprised if the issue was limited to ellipsoid.
The text was updated successfully, but these errors were encountered: