Dynamic SVG Billboard makes TextureAtlas to exceed its maximumTextureSize limit

277 views
Skip to first unread message

André Borud

unread,
May 10, 2016, 10:04:07 AM5/10/16
to cesium-dev
I'm trying to make dynamic label by using a svg on a billboard. I have a couple of lines of texts on each billboard which updates every second or so and there are 30 or so billboards that wants to be updated. 
After a little less than a minute Cesium crashes with the following error:

Billboard.js:952 Error loading image for billboard: DeveloperError: Width must be less than or equal to the maximum texture size (16384).  Check maximumTextureSize.
Error
    at new DeveloperError (DeveloperError.js:44)
    at new Texture (Texture.js:87)
    at resizeAtlas (TextureAtlas.js:222)
    at addImage (TextureAtlas.js:347)
    at TextureAtlas.js:403
    at Object.then (when.js:196)
    at when (when.js:59)
    at TextureAtlas.addImage (TextureAtlas.js:396)
    at Billboard._loadImage (Billboard.js:922)
    at Billboard.setImage (Billboard.js:1011)

And every following billboard update gets this error:

Billboard.js:952 Error loading image for billboard: DeveloperError: xOffset + source.width must be less than or equal to width.
Error
    at new DeveloperError (DeveloperError.js:44)
    at Texture.copyFrom (Texture.js:417)
    at addImage (TextureAtlas.js:344)
    at TextureAtlas.js:403
    at Object.then (when.js:196)
    at when (when.js:59)
    at TextureAtlas.addImage (TextureAtlas.js:396)
    at Billboard._loadImage (Billboard.js:922)
    at Billboard.setImage (Billboard.js:1011)
    at Billboard.defineProperties.image.set (Billboard.js:786)

What I am trying to understand here is if, for each update, Cesium creates a new Texture and adds this to the TextureAtlas? If this is case I can see the TextureAtlas filling up very quickly. Is this the case?

I might have misunderstood how this works, in this case I'm just wondering how I can remove the errors above, otherwise I have some more questions! :)

If the TextureAtlas can be filled, does cesium ever try to find an Texture from the Atlas? Lets say I update a Billboard that uses a svg as the resource, and change it from a circle to a rectangle and back to a circle. Has three Textures been created then or was the switch back to circle relocated in the atlas?

If this is the case is it possible to force one Texture to always use the same node in the TextureAtlas and just update it, to stop the Atlas from increasing? 

If I am forced to switch to labels instead, would this also start filling the TextureAtlas?

Mark Erikson

unread,
May 10, 2016, 12:27:09 PM5/10/16
to cesium-dev
Yeah, it's a known-ish issue.  Basically, the TextureAtlas never tries to re-use space in a texture even if there's no longer a Billboard using that image, so it just keeps accumulating.

See prior discussion in https://groups.google.com/forum/#!topic/cesium-dev/cF9Vt28Wk-4, https://groups.google.com/d/topic/cesium-dev/Sd4x1YmneCs, and https://groups.google.com/forum/#!topic/cesium-dev/JzpfPUvBdEA.  Also, issues https://github.com/AnalyticalGraphicsInc/cesium/issues/2094 and https://github.com/AnalyticalGraphicsInc/cesium/issues/2319.
Reply all
Reply to author
Forward
0 new messages