CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.98k stars 3.5k forks source link

`ModelExperimental` Sandcastle Testing #10379

Closed ptrgags closed 2 years ago

ptrgags commented 2 years ago

ModelExperimental Sandcastles

As part of https://github.com/CesiumGS/cesium/issues/10346, I did a sweep through the old 3D Tiles and Model Sandcastles to see what happens when I set enableModelExperimental = true or use ModelExperimental.fromGltf instead of Model.fromGltf.

EDITED: 07/08/2022

3D Tiles Sandcastles

Working Sandcastles:

Broken Sandcastles:

Other 3D Tiles Sandcastles

These Sandcastles were found by searching "Cesium3DTileset" and "osmBuildings" in the Sandcastle searchbar

Working Sandcastles:

Broken Sandcastles:

Model Sandcastles

For these ones, I replaced Model.fromGltf with ModelExperimental.fromGltf

Working Sandcastles:

Broken Sandcastles:

ptrgags commented 2 years ago

Today I looked into why the glTF 1.0 BIM model crashes in ModelExperimental.

There's one shader that declares the normals as attribute vec2 a_n; and does the oct decoding in the technique's vertex shader.

Trying to allow a special case for this in ModelExperimental will add considerable complexity, so I wouldn't recommend we do that. Better to update the asset to use glTF 2.0

Some thoughts about how to update the model:

Unfortunately this upgrade process would have to be done on a case-by-case basis since glTF techniques are very open-ended (depends highly on the GLSL shader used)

j9liu commented 2 years ago

Came up in #10388: Model keeps its boundingSphere in local space, whereas ModelExperimental returns the bounding sphere in world space (i.e. with modelMatrix applied). The ModelExperimental method is better and more consistent with Cesium3DTileset, we just need to update the Model Sandcastles with this in mind and document it CHANGES.md