1. A concise explanation of the problem you’re experiencing.
addPipelineExtras causes a bad performance problem with large gltf models. I can see a significant pause, like 0.5 second, everytime a new 3d tile is loaded.
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
I am not really familiar what the pipeline-extras are, but I have fixed this issue temporarily by commenting out some parts of the function:
function addPipelineExtras(gltf) {
var objectStack = ;
for (var rootArrayId in gltf) {
if (gltf.hasOwnProperty(rootArrayId)) {
var rootArray = gltf[rootArrayId];
var rootArrayLength = rootArray.length;
for (var i = 0; i < rootArrayLength; i++) {
var rootObject = rootArray[i];
if (defined(rootObject) && typeof rootObject === ‘object’) {
rootObject.extras = defaultValue(rootObject.extras, {});
rootObject.extras._pipeline = defaultValue(rootObject.extras._pipeline, {});
objectStack.push(rootObject);
}
}
}
}
/* Commented out to cure performance problem
while (objectStack.length > 0) {
var object = objectStack.pop();
for (var propertyId in object) {
if (object.hasOwnProperty(propertyId)) {
var property = object[propertyId];
if (defined(property) && typeof property === ‘object’ && propertyId !== ‘extras’) {
objectStack.push(property);
if (!exceptions[propertyId] && !Array.isArray(property)) {
property.extras = defaultValue(property.extras, {});
property.extras._pipeline = defaultValue(property.extras._pipeline, {});
}
}
}
}
}
*/
gltf.extras = defaultValue(gltf.extras, {});
gltf.extras._pipeline = defaultValue(gltf.extras._pipeline, {});
gltf.asset = defaultValue(gltf.asset, {});
gltf.asset.extras = defaultValue(gltf.asset.extras, {});
gltf.asset.extras._pipeline = defaultValue(gltf.asset.extras._pipeline, {});
return gltf;
}
… with this code, the performance problem goes away, but I the main shaders can still load.
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
4. The Cesium version you’re using, your operating system and browser.
Cesium master HEAD