Memory blows up by camera rotation

Hi,

i dont know if its a bug. Im on webgl1, with and OrbitCamera ich load by the assetmanger → assetcontainer several .glb files. Everything is fine at start i can orbit around my object. After a short time the scene or camera freezes / stutters and the js heap is significantly increased. If i check a memory snapshot it says to me that _positions and _positionsCache of the meshes is increased. I tried a lot but have no solution found yet.

Cheers

Hey!
do you want to try to repro it in the Playground? It will be easier to help you

it also happens in your sandbox so maybe something wrong with my models. It is an Agular 11 app so its not so easy build a playground. what i do in the sandbox i drop my model and spin it fast, then the rotation stutters and the chrome javascript VM heap jumps from around 20 to 200mb. The model is about 27mb and is an .glb made with blender.

So maybe its normal but after spining another round the jumps to 400mb.

Can you share your model?

sry i cant share the model because of nda but here ist the protokol from the sandbox. Im worried about the UNSUPPORTED_EXTENSION warning. beacuse ists just compressed with the draco from blender how could i avoid this is there an best practive for glb.

{
“uri”: “”,
“mimeType”: “model/gltf-binary”,
“validatorVersion”: “2.0.0-dev.3.3”,
“validatedAt”: “2021-03-15T10:04:52.317Z”,
“issues”: {
“numErrors”: 0,
“numWarnings”: 1,
“numInfos”: 11,
“numHints”: 0,
“messages”: [
{
“code”: “UNSUPPORTED_EXTENSION”,
“message”: “Cannot validate an extension as it is not supported by the validator: ‘KHR_draco_mesh_compression’.”,
“severity”: 1,
“pointer”: “/extensionsUsed/0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/meshes/0/primitives/0/attributes/TEXCOORD_0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/meshes/0/primitives/0/attributes/TEXCOORD_1”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/meshes/1/primitives/0/attributes/TEXCOORD_0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/meshes/2/primitives/0/attributes/TEXCOORD_0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/meshes/3/primitives/0/attributes/TEXCOORD_0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/meshes/4/primitives/0/attributes/TEXCOORD_0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/bufferViews/0”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/bufferViews/1”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/bufferViews/2”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/bufferViews/3”
},
{
“code”: “UNUSED_OBJECT”,
“message”: “This object may be unused.”,
“severity”: 2,
“pointer”: “/bufferViews/4”
}
],
“truncated”: false
},
“info”: {
“version”: “2.0”,
“generator”: “Khronos glTF Blender I/O v1.5.17”,
“extensionsUsed”: [
“KHR_draco_mesh_compression”
],
“extensionsRequired”: [
“KHR_draco_mesh_compression”
],
“resources”: [
{
“pointer”: “/buffers/0”,
“mimeType”: “application/gltf-buffer”,
“storage”: “glb”,
“byteLength”: 3344976
}
],
“animationCount”: 2,
“materialCount”: 2,
“hasMorphTargets”: false,
“hasSkins”: false,
“hasTextures”: false,
“hasDefaultScene”: true,
“drawCallCount”: 5,
“totalVertexCount”: 678886,
“totalTriangleCount”: 760376,
“maxUVs”: 2,
“maxInfluences”: 0,
“maxAttributes”: 4
}
}

Checking with @bghgary

It looks like there is morph target animation associated with this model. Are you sure it’s because of rotation that causes the frame hitch and jump? If I had to guess, I would think that perhaps a morph target is coming in the picture via animation?

thx for your reply. No there are no animations or morph targets. We were able to reduce the unused objects. But the protocol still says we have 2 unused objects but in blender are only the used meshes e.g. materials. We still got some hickups but the memory stays at a constant level of 230mb after the first camera movement.
Zooming doesnt affect the memory or produces hickups. Bevor camera movement the memory is at 11 - 15 mb.

whats the estimated memory usage for an model of 12mb size with 2 basic pbr materials?

is it possible that the draco compression is part of the problem.

{
“code”: “UNSUPPORTED_EXTENSION”,
“message”: “Cannot validate an extension as it is not supported by the validator: ‘KHR_draco_mesh_compression’.”,
“severity”: 1,
“pointer”: “/extensionsUsed/0”
}

or what does this mean i thought babylon is able to handle draco compressed files.

cheers

Ahh, yes, sorry, I somehow misread the validation report for morph targets. The report does say there are animations though.

This is hard to say. It depends on the model and how it’s represented in the glTF.

I don’t know for sure without a repro. It’s unlikely since draco is decoded at load time. There should be no changes when you move the camera. I don’t see how that’s possible.

When you export it from Blender did you uncheck all the animation options? If not, given you dont have animations anyway, try that.
Also might be worth trying to export without draco compression and then compress manually with gltf-pipeline. I have had some issues with the draco compression in Blender.

1 Like

thx for your help ich cleaned up all the models again and compressed with gltf-pipeline. So i still have a starting hickup and the memory goes up but then it stays on that level. So i guess it is normal somehow.