"Too many fragment shader texture samplers" error on attempt to load tiled layer

956 views
Skip to first unread message

nebul...@gmail.com

unread,
Aug 9, 2013, 9:44:46 AM8/9/13
to cesiu...@googlegroups.com
Dear all!

I'm trying to integrate Cesium to my web application. Everything was fine until I tried to use TileMapServiceImageryProvider to load custom (to be more precise, WorldWind-friendly) BMNG tiled layer in EPSG:4326 of the following directory structure: zoomLevel > tileX > tileY.jpg. Each tile has 512x512 dimensions and number of tiles on level 0 is: 10 for X and 5 for Y (it ideally suits 2:1 proportion of GeographicTilingScheme). I get the following errors in JavaScript console:

------------------

[GL] Shader program link log: error: Too many fragment shader texture samplers ShaderProgram.js:2616

createAndLinkProgram ShaderProgram.js:2616
ShaderProgram ShaderProgram.js:2199
Context.createShaderProgram Context.js:1004
ShaderCache.getShaderProgram ShaderCache.js:70
CentralBodySurfaceShaderSet.getShaderProgram CentralBodySurfaceShaderSet.js:85
createRenderCommandsForSelectedTiles CentralBodySurface.js:984
CentralBodySurface.update CentralBodySurface.js:123
CentralBody.update CentralBody.js:706
CompositePrimitive.update CompositePrimitive.js:397
Scene.render Scene.js:683
CesiumWidget.render CesiumWidget.js:409
render CesiumWidget.js:67


Uncaught TypeError: Cannot call method 'raiseEvent' of undefined CesiumWidget.js:75

render CesiumWidget.js:75

------------------


Here is how I try to load my tiled layer:

WebGlobe.Cesium.prototype.initialize = function() {

this._cesium = new Cesium.CesiumWidget(this._params['id'], {
'imageryProvider': new Cesium.OpenStreetMapImageryProvider({
'url': this._params['openStreetMapServerUrl']
})
});

var layers = this._cesium.centralBody.getImageryLayers();

var satelliteImageryProvider = new Cesium.TileMapServiceImageryProvider({
'url' : "http://web-catalog/tiles/bmng",
'fileExtension': "jpg",
'tilingScheme': new Cesium.GeographicTilingScheme({
numberOfLevelZeroTilesX: 10,
numberOfLevelZeroTilesY: 5
}),
'tileWidth': 512,
'tileHeight': 512
});
layers.addImageryProvider(satelliteImageryProvider);
}


Removing OpenStreetMapImageryProvider and limiting TileMapServiceImageryProvider by setting maximumLevel to 0 don't make sense. But setting numberOfLevelZeroTilesX to 2 and numberOfLevelZeroTilesY to 1 does. I'm not really familiar with OpenGL and shaders but does it mean that amount of simultaneously rendered tiles is strictly limited? Does it depend on my videocard or I can customize it programatically (on software level)?

My operating system is Ubuntu 12.04 LTS, ASUS X73S.


Thanks a lot for your attention and time!

Kevin Ring

unread,
Aug 9, 2013, 10:10:57 AM8/9/13
to cesiu...@googlegroups.com
Hi,

Yes, the number of textures that can be attached to a single tile is limited by hardware.  You can find the number for your hardware by visiting http://webglreport.com/ and looking at the "Max Texture Image Units" field under "Fragment Shader".

We can work around this limit by rendering in multiple passes, but we haven't done so yet.  Even if we did, it would probably result in poor performance.  A much better solution, whenever possible, is to ensure that your tiling scheme only has a few (4 or less) tiles at the root level.  Is that possible in your case?  In a pinch, you can simulate it.  Write a custom imagery provider that loads the 10x5 tiles at the root level, and resamples them to progressively smaller tiles until there are only a few at the root.

Kevin


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



nebul...@gmail.com

unread,
Aug 9, 2013, 10:25:11 AM8/9/13
to cesiu...@googlegroups.com
Dear Kevin!

Thanks a lot for clear answer. I have 16 max texture image units so will look for possibility to convert a cache to 2x1 tiles at level 0. Probably I'll have a luck to find existing tools for that.

Thank you again. It was very helpful.


пятница, 9 августа 2013 г., 18:10:57 UTC+4 пользователь Kevin Ring написал:
Reply all
Reply to author
Forward
0 new messages