Cesium loads all LODs at once

I have created a 3D tileset. It can be seen right here and it looks like so:

{
  "asset": {
    "version": "1.0"
  },
  "geometricError": 100.0,
  "root": {
    "transform": [
      -0.6948750431427922,
      0.7191304988785433,
      0.0,
      0.0,
      -0.3992857187445959,
      -0.3858182645175394,
      -0.8316941634827585,
      0.0,
      -0.5980966386997288,
      -0.5779235177316903,
      0.5552340213177814,
      0.0,
      2552673.4802513956,
      2466574.700259976,
      5281509.944505653,
      1.0
    ],
    "boundingVolume": {
      "box": [
        35.313999999999595,
        -5.6,
        54.188247938924995,
        36.804,
        0.0,
        0.0,
        0.0,
        -8.3,
        0.0,
        0.0,
        0.0,
        57.04824793892501
      ]
    },
    "geometricError": 100.0,
    "refine": "ADD",
    "content": null,
    "children": [
      {
        "transform": null,
        "boundingVolume": {
          "box": [
            35.313999999999595,
            -5.6,
            54.188247938924995,
            36.804,
            0.0,
            0.0,
            0.0,
            -8.3,
            0.0,
            0.0,
            0.0,
            57.04824793892501
          ]
        },
        "geometricError": 2187.0,
        "refine": "REPLACE",
        "content": {
          "uri": "LOD-7/lod_7_drc.glb"
        },
        "children": [
          {
            "transform": null,
            "boundingVolume": {
              "box": [
                35.313999999999595,
                -5.6,
                54.188247938924995,
                36.804,
                0.0,
                0.0,
                0.0,
                -8.3,
                0.0,
                0.0,
                0.0,
                57.04824793892501
              ]
            },
            "geometricError": 729.0,
            "refine": "REPLACE",
            "content": {
              "uri": "LOD-6/lod_6_drc.glb"
            },
            "children": [
              {
                "transform": null,
                "boundingVolume": {
                  "box": [
                    35.313999999999595,
                    -5.6,
                    54.188247938924995,
                    36.804,
                    0.0,
                    0.0,
                    0.0,
                    -8.3,
                    0.0,
                    0.0,
                    0.0,
                    57.04824793892501
                  ]
                },
                "geometricError": 243.0,
                "refine": "REPLACE",
                "content": {
                  "uri": "LOD-5/lod_5_drc.glb"
                },
                "children": [
                  {
                    "transform": null,
                    "boundingVolume": {
                      "box": [
                        35.313999999999595,
                        -5.6,
                        54.188247938924995,
                        36.804,
                        0.0,
                        0.0,
                        0.0,
                        -8.3,
                        0.0,
                        0.0,
                        0.0,
                        57.04824793892501
                      ]
                    },
                    "geometricError": 81.0,
                    "refine": "REPLACE",
                    "content": {
                      "uri": "LOD-4/lod_4_drc.glb"
                    },
                    "children": [
                      {
                        "transform": null,
                        "boundingVolume": {
                          "box": [
                            35.313999999999595,
                            -5.6,
                            54.188247938924995,
                            36.804,
                            0.0,
                            0.0,
                            0.0,
                            -8.3,
                            0.0,
                            0.0,
                            0.0,
                            57.04824793892501
                          ]
                        },
                        "geometricError": 27.0,
                        "refine": "REPLACE",
                        "content": {
                          "uri": "LOD-3/lod_3_drc.glb"
                        },
                        "children": [
                          {
                            "transform": null,
                            "boundingVolume": {
                              "box": [
                                35.313999999999595,
                                -5.6,
                                54.188247938924995,
                                36.804,
                                0.0,
                                0.0,
                                0.0,
                                -8.3,
                                0.0,
                                0.0,
                                0.0,
                                57.04824793892501
                              ]
                            },
                            "geometricError": 9.0,
                            "refine": "REPLACE",
                            "content": {
                              "uri": "LOD-2/lod_2_drc.glb"
                            },
                            "children": [
                              {
                                "transform": null,
                                "boundingVolume": {
                                  "box": [
                                    35.313999999999595,
                                    -5.6,
                                    54.188247938924995,
                                    36.804,
                                    0.0,
                                    0.0,
                                    0.0,
                                    -8.3,
                                    0.0,
                                    0.0,
                                    0.0,
                                    57.04824793892501
                                  ]
                                },
                                "geometricError": 3.0,
                                "refine": "REPLACE",
                                "content": {
                                  "uri": "LOD-1/lod_1_drc.glb"
                                },
                                "children": [
                                  {
                                    "transform": null,
                                    "boundingVolume": {
                                      "box": [
                                        35.313999999999595,
                                        -5.6,
                                        54.188247938924995,
                                        36.804,
                                        0.0,
                                        0.0,
                                        0.0,
                                        -8.3,
                                        0.0,
                                        0.0,
                                        0.0,
                                        57.04824793892501
                                      ]
                                    },
                                    "geometricError": 0.0,
                                    "refine": "REPLACE",
                                    "content": {
                                      "uri": "LOD-0/lod_0_drc.glb"
                                    },
                                    "children": []
                                  }
                                ]
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

So, as you can see, every single LOD is a separate glb-file. In my case they are created by blender with the help of decimate modification. So every one LOD has simpler geometry and less number of polygons/vertices.

My expectation is that Cesium should load different LODs one by one, as I zoom in or zoom out. But what I see is that when the page loads for the first time, all glb files are loaded to the client.

The demo, that you can try it yourself can be seen here

And this is what I’m talking about:

What may be wrong with that?

And another (but less important) problem, is that I see this error message in the console:

Object { statusCode: 401, response: ā€˜{ā€œcodeā€:ā€œInvalidCredentialsā€,ā€œmessageā€:ā€œNo authorization token was foundā€}’, responseHeaders: {…} }

Even though, I do not use Ion services and I also set

Cesium.Ion.defaultAccessToken = null

How can I fix this error message?

I also tried another version of tileset.json:

{
  "asset": {
    "version": "1.1"
  },
  "root": {
    "transform": [
      -0.6948750431427922,
      0.7191304988785433,
      0.0,
      0.0,
      -0.3992857187445959,
      -0.3858182645175394,
      -0.8316941634827585,
      0.0,
      -0.5980966386997288,
      -0.5779235177316903,
      0.5552340213177814,
      0.0,
      2552673.4802513956,
      2466574.700259976,
      5281509.944505653,
      1.0
    ],
	"boundingVolume": {
	  "box": [
		35.313999999999595,
		-5.6,
		54.188247938924995,
		36.804,
		0.0,
		0.0,
		0.0,
		-8.3,
		0.0,
		0.0,
		0.0,
		57.04824793892501
	  ]
	},
	"geometricError": 2187.0,
	"refine": "REPLACE",
	"content": {
	  "uri": "LOD-7/lod_7_drc.glb"
	},
	"children": [
	  {
		"transform": null,
		"boundingVolume": {
		  "box": [
			35.313999999999595,
			-5.6,
			54.188247938924995,
			36.804,
			0.0,
			0.0,
			0.0,
			-8.3,
			0.0,
			0.0,
			0.0,
			57.04824793892501
		  ]
		},
		"geometricError": 729.0,
		"refine": "REPLACE",
		"content": {
		  "uri": "LOD-6/lod_6_drc.glb"
		},
		"children": [
		  {
			"transform": null,
			"boundingVolume": {
			  "box": [
				35.313999999999595,
				-5.6,
				54.188247938924995,
				36.804,
				0.0,
				0.0,
				0.0,
				-8.3,
				0.0,
				0.0,
				0.0,
				57.04824793892501
			  ]
			},
			"geometricError": 243.0,
			"refine": "REPLACE",
			"content": {
			  "uri": "LOD-5/lod_5_drc.glb"
			},
			"children": [
			  {
				"transform": null,
				"boundingVolume": {
				  "box": [
					35.313999999999595,
					-5.6,
					54.188247938924995,
					36.804,
					0.0,
					0.0,
					0.0,
					-8.3,
					0.0,
					0.0,
					0.0,
					57.04824793892501
				  ]
				},
				"geometricError": 81.0,
				"refine": "REPLACE",
				"content": {
				  "uri": "LOD-4/lod_4_drc.glb"
				},
				"children": [
				  {
					"transform": null,
					"boundingVolume": {
					  "box": [
						35.313999999999595,
						-5.6,
						54.188247938924995,
						36.804,
						0.0,
						0.0,
						0.0,
						-8.3,
						0.0,
						0.0,
						0.0,
						57.04824793892501
					  ]
					},
					"geometricError": 27.0,
					"refine": "REPLACE",
					"content": {
					  "uri": "LOD-3/lod_3_drc.glb"
					},
					"children": [
					  {
						"transform": null,
						"boundingVolume": {
						  "box": [
							35.313999999999595,
							-5.6,
							54.188247938924995,
							36.804,
							0.0,
							0.0,
							0.0,
							-8.3,
							0.0,
							0.0,
							0.0,
							57.04824793892501
						  ]
						},
						"geometricError": 9.0,
						"refine": "REPLACE",
						"content": {
						  "uri": "LOD-2/lod_2_drc.glb"
						},
						"children": [
						  {
							"transform": null,
							"boundingVolume": {
							  "box": [
								35.313999999999595,
								-5.6,
								54.188247938924995,
								36.804,
								0.0,
								0.0,
								0.0,
								-8.3,
								0.0,
								0.0,
								0.0,
								57.04824793892501
							  ]
							},
							"geometricError": 3.0,
							"refine": "REPLACE",
							"content": {
							  "uri": "LOD-1/lod_1_drc.glb"
							},
							"children": [
							  {
								"transform": null,
								"boundingVolume": {
								  "box": [
									35.313999999999595,
									-5.6,
									54.188247938924995,
									36.804,
									0.0,
									0.0,
									0.0,
									-8.3,
									0.0,
									0.0,
									0.0,
									57.04824793892501
								  ]
								},
								"geometricError": 0.0,
								"refine": "REPLACE",
								"content": {
								  "uri": "LOD-0/lod_0_drc.glb"
								},
								"children": []
							  }
							]
						  }
						]
					  }
					]
				  }
				]
			  }
			]
		  }
		]
	  }
	]
  },
  "extensionsUsed": [
	"3DTILES_batch_table_hierarchy"
  ],
  "extensionsRequired": [
	"3DTILES_batch_table_hierarchy"
  ]
}

But it produces the very same result. I guess, the whole problem is with geometricError. My current values are produces by Obj2Tiles tool. Probably, they are not correct. The whole concept of geometricError is driving me nuts a little bit. I’ve just switched on debugShowGeometricError: trueand see that the visible geometricError values have nothing in common with the values from mytileset.json`. Can you, please, advise the right way of setting these geometricError values? And also explain why in some working examples there are values like 1, 0.9, 0.05 etc and in others there are values like 12300. In other words they differ very significantly.

I guess, my whole problem narrows down to this question - how can we skip loading lower quality LODs when zooming/flying to a particular place on the map? So for example, when I flyTo some point where geometricError is 9, I do not want to load LODs for geometricErrors 27 and higher. Is it possible to do this?

Regarding the error message: I think that not setting Cesium.Ion.defaultAccessToken = null; might already resolve this. If not, it might be best to open a dedicated issue (probably in the CesiumJS section) with more details about the setup.

Regarding the actual question: CesiumJS does in this case load all LODs at once, because it needs the highest level of detail (in this case) to stay below the ā€œmaximum screen space errorā€. The geometric error of a tile is used for computing the screen space error, and if the screen space error is larger than the maximum, then a tile with a higher LOD will be loaded (which has a lower geometric error, and will cause a lower screen space error).

For example, this sandcastle sets the maximumScreenSpaceError of the tileset to a very high value (4096, with the default being 16):

Initially, it only loads the coarsest version of the tile data. When zooming in, it loads the higher-resolution data:

Cesium LOD Loading

(An aside: There seems to be zero visual difference between the levels of detail. So you might consider only using LOD 7 to begin with, and apply further simplifications to that…)

how can we skip loading lower quality LODs when zooming/flying to a particular place on the map?

The question of ā€˜what exactly is loaded’ is affected by many things, but mainly by the geometric error, the maximum screen space error, and the camera orientation. When you have a large tileset and the camera is looking only at a small portion of it, then it should only load tiles in the visible area. (This does not apply here, because all tiles are at the same location).

1 Like