Interpolation performance?


I’m currently rendering a large number of polygons which change both color and extrudedHeight over time from CZML. Performance in b28 is actually very good if I simply render lots of different polygons with different height, color and availabilities (not using interpolation). The result is jittery/jumpy but performance is good. However, if I render a single polygon for each data point (of which there are several thousand) and use interpolation to determine the color and extrudedHeight over time, then there is a massive performance hit, to the point of becoming unusable.

In fact, just interpolating color over time performs well (this seemed to change from b27 to b28?) but interpolating extrudedHeight for the polygons seems to make things much worse.

Are there any ways to avoid quite such a performance hit? Are there parameters I can specify which will cut down how often the interpolation method is called / the viewer “ticks”? Are there any plans for improvements?


Matthew Gwynne


This is slow because the geometry is rewritten each frame. The best way to do this would be with a custom geometry and appearance that scales the height in the vertex shader so only the height value needs to change, not all the geometry. I’d like to write a tutorial on custom geometry and appearances using this as an example, but I can’t promise it any time soon as we work towards 1.0.

The idea is to create the extruded geometry as usual but with a height equal to zero and to have an extra vertex attribute flagging vertices as on the “top” or “bottom” of the extruded polygon. Then the vertex shader used by the appearance would take the height as a uniform and extrude vertices that have the “top” attribute. This will allow for very fast - basically free - height updates.

This, of course, would also need to be wired up to CZML.