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

Polygon blinking on hierarchy update #7934

Closed
IgnacioRoldan opened this issue Jun 12, 2019 · 10 comments
Closed

Polygon blinking on hierarchy update #7934

IgnacioRoldan opened this issue Jun 12, 2019 · 10 comments

Comments

@IgnacioRoldan
Copy link

Hi,

I have defined a polygon and I am updating his vertices periodically with a different period of the render cycle. In version 1.50 this used to work nice, but in the new version the polygon blinks everytime the positions are updated. I have made four sandcastles to show this behaviour:

Version 1.50, property perPositionHeight=true (it works GOOD)
https://cesiumjs.org/releases/1.50/Apps/Sandcastle/index.html#c=7VVdT9swFP0rVl+ais5pQQgJClpVkFYJNgTdXpY9uMltas2xu2s7I0z89918tEkHD5vYy6RZVWP73HOuP47tXCDLJXwHZOdMw3c2Ayt9xj9VfUE/rpozo52QGrA/ZD8izajITKSAxS2aXCbEPt0yYwThYCEV3IjNPWAuY5jvBweNRlk8qpa79FIlNybxCj6iCvpTa8HZcAEPziPY8L2gr1BXAt16Pu8PapmnwbCuLIWFa1EA3sr4azWmlVAWGjQFE5vkWTfCNw/W3YEmjHID4Q79Fs7Eg8x8VsMLmcFsLXRaBs31Smrpikg/Dc4iHemc1jIRTtwbjzHsr+fMW2eyyx0aRL246op6JbneAt6yLRdJErTtNgNCcmtUkRpNGdoADtpJJxtis8BaZOVI+3eQsE1Dop/1uBIx9JspbpFT1tmXtQQUGK+LdndmtOxUE/qIr5AmAykC2CmiKILPb8bjYz4asqMT+m9l/rTsZA5fKTM6qWSOXitzWMmM/44MTe3LoCOU0UlBKTonYGaUQX53ddlYe2euSNNRmGuKz4UKsLLjkB2PRiXchfyGTAFTOoVDdjiq8UivvI6dpE2umcGg2erGeDYGDXzvKAQl8WnrOklmG511dNo0O62XzIiQmRymSgX1OKqc/13877qYHTBZO7ms/a6bO1Ebup6NlaWJ3oFM1665b381fPXIsAOyHT/eObF266Mx2cIEL9hmcNYb9ibWFQouaom3MtsYdOU7E3AeOsg2isZpw6WnN8Lx2Noy3yTckiaJzJlMzumC3n/7oh6LlbCWkJVX6l4+QtS7mIQUv0dTRiRSpx9yQCWKMmQ9vriuOznnk5Caz1nOGLUU2FH8CQ

Version 1.50, property perPositionHeight=false (it works BAD)
https://cesiumjs.org/releases/1.50/Apps/Sandcastle/index.html#c=7VVNTxsxEP0rVi7ZiNSbgBASBNQocIgELYK0l24PjneSWPXa6dheWBD/vbMfySaCS0svlWpFie03743teY5zgSxX8ADIzpmBBzYBp0LGv1ZzUVdWw4k1XigD2O2z58QwaioTS8DiFm2uUmKfbpgSQXiYKQ03Yn0PmCsJ0/3gqNEoW0DdcudB6fTGpkHDF9RRd+wceBfP4NEHBBd/EvQr9JVAv5pOu71a5qXXrztz4eBaFIC3Sv6o1rQQ2kGDLsFKm76aRvgZwPk7MIRRbiDcY9jAmXhUWchqeKYymKyEWZZBU7NQRvkiMS+9s8QkJqezTIUX9zaghP3znATnbXa5RaOkI6uppFOS6xLwlu24SNOoHbcZENJbq4ulNZShDeBgvPKqITYHbERWrrR7BylbNyT6uIALIaHbbHGDnLKduqwUoEC5KtrqTOjYqSfMEV8gbQaWCODGiKKIvn0YDo/5oM+OTui7lfndtpU5fKfM4KSSOXqvzGElM/w7MrS1770doYxuCiqxcwMmVlvkd1eXjbW35koMXYWpofhc6AgrO/bZ8WBQwrtQWJMpYEy3sM8OBzWemEUw0isqcs2Mek2pG+M5CQb43lWISuLLxnWKzDY429Fp02y13jIjQmZzGGsd1euocv538b/rYnbAVO3ksvenbq5eEHZAnuLHW5vVVnyyNpvZ6A1P9M46/c7I+ULDRS3xUWVri758RCLOYw/ZWtMiXDwP9AB4Lp0r843iDWmUqpyp9Jz+ffcftqTDpBbOEbIIWt+rJ0g6F6OY4vdo2opUmeXnHFCLogxZDS+u60nO+Sim4WuWt1bPBe4o/gI

Version 1.57, property perPositionHeight=true (it works BAD)
https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=7VVta9swEP4rIl/i0MxOWkqhTcNCWlig3UKa7cu8Dxf7nIjJUibJbt3R/77zS/yyFrbRfRnMhNjS3fPcSfeclIJmKcd71OySSbxnczQ8id1PxZzTD4rhXEkLXKLuD9l3XzJ6eAxb1NlSq5SHhD4/IAONYHHNBd7C/g51ygNcdJ2diiN/Ei0a7CbhIrxVYSLwoxZOf2YMWuOt8cEmGo33HugN4hq03S0W/UFJ8zQYlh8bMHgDGeolD74WOUUgDFbWLapAhc+mNX5L0NgVSrJRbCS71cnBHMMDj5O4NK95jPMdyG3utJARl9xmvnwaXPjSlyntZQgW7lSiA+zu5zwxVsVXtdXxe0Ex5fdycFkCt0EbF8LQacZNBI3hUolsqyRFaBxclJZbXgGrDZYQ55n2VxiyfQWin0l0BAH2qyUeLOesVZcdRw062GVNdea07fQF8sSNNC0GtxrRzLSGzPn8Zjw+dUdDdnJG/w3Nnz41zfEraUZnBc3Ja2mOC5rx36GhpX0ZtIhi6hTNodUBcyWUdlfXV5W0a3H5klphIck/BeHoQo5Ddjoa5ea2KdmTKHBGXThkx6PS7ssokYHlVOQS6QyqUlfCMwFKdDut4OTAp4PqOIltdNHiacLUXC+JUWOsUpwJ4ZR5FDH/q/jfVTE7YrxUcv71u2puee3peFaG5yJ6h3y7s9V5+7Pgi0uGHZHs3NNaiaVaH5WK18p5QTY5tDfsTYzNBE5Lkrc83itt85vGcV3PYrwXlKnxNgndEtYNTAGbeAfQJOQp4+ElHdHd28/vsUCAMWSJEiHu+CP6venEI/8OTCgIudx+SFELyHKX3Xh6U066rjvxaPgcZZUSG6AgVd4TCxuBdUQuI7UEiaJ2KJ02Ksw6E3rarfHEhtMbjCwx0bXIrGLUWwwYZWfxgbIhewvvdQle5lsVhasJjaWmKq47s4M9/oKThq2kaZSvM9+Kakt+AA

Version 1.57, property perPositionHeight=false (it works BAD)
https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=7VVta9swEP4rIl/i0MxOWkqhTcNCWlig3UKa7cu8Dxf7nIjJUibJbt3R/77zS/yyFrbRfRnMhNjS3fPcSfeclIJmKcd71OySSbxnczQ8id1PxZzTD4rhXEkLXKLuD9l3XzJ6eAxb1NlSq5SHhD4/IAONYHHNBd7C/g51ygNcdJ2diiN/Ei0a7CbhIrxVYSLwoxZOf2YMWuOt8cEmGo33HugN4hq03S0W/UFJ8zQYlh8bMHgDGeolD74WOUUgDFbWLapAhc+mNX5L0NgVSrJRbCS71cnBHMMDj5O4NK95jPMdyG3utJARl9xmvnwaXPjSlyntZQgW7lSiA+zu5zwxVsVXtdXxe0Ex5fdycFkCt0EbF8LQacZNBI3hUolsqyRFaBxclJZbXgGrDZYQ55n2VxiyfQWin0l0BAH2qyUeLOesVZcdRw062GVNdea07fQF8sSNNC0GtxrRzLSGzPn8Zjw+dUdDdnJG/w3Nnz41zfEraUZnBc3Ja2mOC5rx36GhpX0ZtIhi6hTNodUBcyWUdlfXV5W0a3H5klphIck/BeHoQo5Ddjoa5ea2KdmTKHBGXThkx6PS7ssokYHlVOQS6QyqUlfCMwFKdDut4OTAp4PqOIltdNHiacLUXC+JUWOsUpwJ4ZR5FDH/q/jfVTE7YrxUcv71u2puee3peFaG5yJ6h3y7s9V5+7Pgi0uGHZHs3NNaiaVaH5WK18p5QTaHXukNexNjM4HTkugtj/dK2/y2cVzXsxjvBWVrvE1CN4V1A1NAJ94BNAl5ynh4Scd09wb0eywQYAxZokSIO/6Ifm868ci/AxMKQi63H1LUArLcZTee3pSTrutOPBo+R1mlxAYoSJX3xMJGYB2Ry0gtQaKoHUqnjQqzzoSedus8seH0BiNLTHQ1MqsY9RcDRtlZfKBsyN7Ce12Cl/lWRfFqQmOpsYorz+xgj7/gpGEraRrl68y3otqSHw

The conclusions are:

  1. This code works nice in version 1.50, the update of the shape is smooth with no blinking.
  2. This code does NOT work in version 1.57, the polygon blink everytime is updated. To get the same smoothness I will need to use the CallbackProperty that leads to high GPU consumption.
  3. If the property "perPositionHeight" of the polygon is removed it does not work in any of the versions.

I think it should work always as 1. so it migth be a bug.

Regards,

Ignacio Roldan.

@OmarShehata
Copy link
Contributor

Thanks for the Sandcastles and the minimal code examples @IgnacioRoldan ! On one hand, this is intentional in that entity geometries are created/updated asynchronously (see my response and some elaboration here #7782 (comment)).

On the other hand, this is something that has come up dozens of time on the forum over the last year, and especially in cases like when you have requestRenderMode on, you really don't want to use a CallbackProperty and update it every frame when it may be updating much less frequently.

I think we should leave this open to see what others on the team think here. One option could be to expose an asynchronous flag on entities, so all you'd have to do is set that to false and this would be the easiest way to get no blinking here.

This could be a larger issue though because I think throughout the entity system, the assumption is that properties are static by default, so changing a position property may not update the underlying primitive in some situations (I think).

@IgnacioRoldan
Copy link
Author

Hi @OmarShehata, thank you for your response. I see your point with the creating/updating asynchronously and I can understand that this may be better is most cases. However, why this used to not blink in version 1.50? The behaviour was changed in posterior versions? It was a bug in the version 1.50?

@jpespartero
Copy link

@OmarShehata
Copy link
Contributor

@jpespartero you'll need to use a CallbackProperty as I describe here #7934 (comment) to mark the polygon as dynamic.

@jpespartero
Copy link

jpespartero commented Jul 22, 2019

Dear @OmarShehata, thanks for your response. We had already implemented the polygon update with callbacks. In that case, the update is done correctly without blink but we have a performance drawback.

We are using the Explicit Rendering mode (requestRenderMode=true), as we usually updates the polygons at low frequency (1-2 seconds). In this mode, the GPU and CPU usage is very low (<1% in a MacBook Pro 2017 laptop).

The issue with the callback mode is that the GPU and CPU usage increases significantly (>30%). It seems that the callback is being called continuously, not only when a request render is made. See attached an example with requestRenderMode=true and a callback function. The fps panel shows that it is executing in throttled mode, instead of explicit rendering.

Is there some way that the callback will only be called when scene.requestRender is called? Or is it the expected behavior?

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=7VXfb9owEP5XLF4IKkugVVWppWiIdhpStyFge1n6YJIDrDo2Oztp04r/fZcfJGGttE2ttJdFiMS++747+76zE44sEXAPyC6Zgns2BiPiyP2WzzntIB+OtbJcKMB2lz35itEjIr4GTKeoExES+nyPDBC4hYWQ8Ilv54CJCGBy6OyUHNkTo6yxy1jI8JMOYwlfUTrtkTFgjbeABxsjGO8zpzeX1xztZjJpdwqaXadbfCy5gRueAk5FcJfntOLSQGldgw50+Gwa4UcMxs5AkY1iA9ktxntzxB9EFEeFeSEiGG+4WmdOE7USStjUV7vOha98ldBehtzyuY4xgMP9HMfG6uiqsjp+K8in/FYGLkrg1mjj8jB06nEdASGcapmutaIItYMLygorSmC5wYpHWabtGYRsW4LoZ2Jc8QDa5RL3lnPWqMtGAHIMNmldnTFtO31xdeKukBYDawQwI0SeOt/f9funbq/LTs7ov6b526eiOX4lTe8spzl5Lc1xTtN/Gxpa2m2nQRRRp6DgjQ4Ya6nRnV1fldKuxOUraoWJIv+ESwdzOXbZaa+XmZumeEuigBF1YZcd9wq7r1axCqygIhdIp1OWuhSeCUCBe9AKTgbc7VUnSGy9iwZPHabiekmMCJFOYCSlU+SRx/w3Km52I5dyyYM7OpC2gDZ19styOuwJgQ4Z9V/0byJ6dsREIfzs67az6+Zn7x82QcOL6jTVRmRF+ghivbHlMf1rn+R3EzsitbqnlYCbIg9hGa/nG33/AUlXZgo4h0CrkHSY8dWH8aPW0UI7L4gzi9TqtgbGphKGRcz3ItpqtNl95riuZyHaSlqY8ZYx3UXWDUwOG3h70CAUCRPhJV0Eh3es32KB5MaQZRVLOReP4LeGA4/8D2BS81Co9ZcEUPI0c9n0hzfFpOu6A4+Gz1FWa5I+BSnzHli+lFBFFGqlp1yBrBwKp6UO04MJHB5KY2DD4Q2sLDHR5cusZtTBjDPKzsIDZUP2Bt47JHiZb5bXuSI0lnoxb2Oz4Vv4DScNG0nTKFtnthXllvwE

@OmarShehata
Copy link
Contributor

@jpespartero, unfortunately this is a known issue. Using a CallbackProperty with requestRenderMode will essentially force a redraw every frame. I've complained about this and suggested a solution here:

#6631 (comment)

Feel free to bump that issue/continue discussion there to get support for a better solution here.

@hpinkos
Copy link
Contributor

hpinkos commented Sep 19, 2019

The blinking is due to using static entities. They blink because they render asynchronously. As @OmarShehata stated, using a CallbackProperty will make the geometry dynamic, and dynamic geometry will draw synchronously so you won't see the blinking.

@hpinkos hpinkos closed this as completed Sep 19, 2019
@jpespartero
Copy link

@hpinkos the issue with the CallbackProperty is that forces a redraw every frame and the requestRenderMode does not work, increasing significantly the CPU/GPU resources usages for a scene that is updated at low frequency (1-2 seconds).

This issue is discussed in #6631 as @OmarShehata stated, but I don't know if it's better to leave the issue open until the other one is resolved.

@hpinkos
Copy link
Contributor

hpinkos commented Sep 27, 2019

@jpespartero This is unfortunately one of the shortcomings of the Entities API. It is really efficient at drawing things that either never update, or update constantly, but its not ideal for things that update intermittently.

Instead, you could try using lower level Geometry and Appearances. You can see how to draw a polygon in this example: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/development/Polygon.html

When you need to make changes, you would remove the old primitive, create a new one, then scene.requestRender to render the new primitive.

@jpespartero
Copy link

@hpinkos many thanks for the response, we are going to implement it in that way.

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

4 participants