JS SceneView: scene animation is undetermined when update camera

708
2
Jump to solution
12-28-2019 12:35 AM
YenNguyen
New Contributor

Hello there,

I am developing a Javascript app using ArcGIS Online JSAPI 4.13 on latest version of Chrome browser. I have a polyline drawn on 3D scene view, i would animate the view around the line in bird eyes view mode. I have done it with view.goTo(target, options) easily but debugging on Chrome showing some render performance issues that fps gets very low. So I switched to try out to control the camera manually, I see the FPS got better if in case I don't reset the view center at every requestAnimationFrame loop but in such situation the animation gone undetermined, if I do reset the view center to target point the view animated as expected. See my code snippet below.

I have 3 questions would like to ask:

1. Is this true the view.goTo(target, options) will slow down render FPS in comparison with props.view.camera manually update?

2. Why reset view center at every animation frame causing FPS dropped?  and this leads to the third question

3. Why do I need to update the view center at every animation loop in order to get animated view as expected, isn't camera's heading, tilt, position update enough to calculate view perspective?

Any hint would be much appreciated, I got stuck on this few days  

Thanks

Yen

// 1. Update the camera at each requestAnimationFrame
let camera = props.view.camera.clone();
camera.heading = heading;
camera.tilt = tilt;
camera.position = position;
view.camera = camera;
// 2. if I do update the view like this, the animation will run as expected but the FPS got very low
var center = props.view.center.clone();
center.longitude += position.longitude - center.longitude;
center.latitude += position.latitude - center.latitude;
view.center = center;
 
0 Kudos
1 Solution

Accepted Solutions
VeronikaLanders
Esri Contributor

Hi Yen,

view.goTo should not be slower than manually updating the camera. Could you please provide a sample app to demonstrate this problem?

Generally it is expected that Chrome will state 60 fps while the view stays the same since nothing (new) is rendered. As soon as the view is changed a FPS drop is expected depending on your machine's capacity since now every frame actually needs to be rendered.

Best,

Veronika

View solution in original post

2 Replies
VeronikaLanders
Esri Contributor

Hi Yen,

view.goTo should not be slower than manually updating the camera. Could you please provide a sample app to demonstrate this problem?

Generally it is expected that Chrome will state 60 fps while the view stays the same since nothing (new) is rendered. As soon as the view is changed a FPS drop is expected depending on your machine's capacity since now every frame actually needs to be rendered.

Best,

Veronika

YenNguyen
New Contributor

Thank Veronika for the answer. It helped me to finger out the problem neither because of camera update  nor view.goto, indeed the cumulated polyline graphic rendering frames overtime caused FPS dropped.

0 Kudos