Geodan / i3dm.export

Export 3D Instanced Tiles from PostGIS table
MIT License
42 stars 22 forks source link

Problems with gpu instancing: location, scale, model integrity #74

Closed chekhovana closed 1 month ago

chekhovana commented 1 month ago

@bertt, hello,

I created tileset with single object (tree) to demonstrate the problem I encountered with. Without gpu instancing, generated tileset looks as expected:

Screenshot 2024-10-14 at 14 50 35

But when I enable gpu instancing, then object scale and location are invalid:

Screenshot 2024-10-14 at 14 52 42

Also the model is corrupted. Original:

Screenshot 2024-10-14 at 15 06 07

From tileset:

Screenshot 2024-10-14 at 15 15 12

Model and tileset are available at https://drive.google.com/drive/folders/1oO32_vzYSDY18r3n0mh-dj7q4U03gAcP?usp=drive_link

bertt commented 1 month ago

Quick inspection: The used model is a bit complicated (mesh has multiple nodes) and uses another extension like KHR_materials_ior, KHR_materials_specular. Can take a look if this can be fixed, but for now better use a more simple tree model (or use i3dm's).

chekhovana commented 1 month ago

ok, thank you!

bertt commented 1 month ago

Nb: the input file is not valid (see https://github.khronos.org/glTF-Validator/), with https://gltf.report/ a script can be run to fix it and the result can be exported (size reduces from 18MB to 11MB)

bertt commented 1 month ago

Issue is in the multiple meshes, could make it work but then getting the attributes in CesiumJS was not longer working... Will look again later. Anyhow, its quite a large model, creating/visualizing tiles will be much slower... I think using a simpler model will make more sense.

chekhovana commented 1 month ago

@bertt, hello

the problem is that I need the trees to look realistic. What are the appropriate size limitations for the model? Is 10MB ok?


Small side question: I am having warnings in Unreal Editor from Cesium plugin:

LogCesium: Warning: Invalid accessor for instance scales LogCesium: Warning: Invalid accessor for instance translations

However I can't notice any visualization problems when getting these warnings. Should I address this problem to Cesium team?

bertt commented 1 month ago

about the warning, have never seen it.

some questions:

chekhovana commented 1 month ago

hello @bertt

some questions:

  • This is with I3dm's?

no, i3dm's are generated with --use_gpu_instancing false produce no warnings. Warnings appear when tileset is generated with --use_gpu_instancing true, tiles have .glb extension

  • Does this warning also occur with valid glTF ?

yes, even with Box.glb, if gpu instancing support is enabled

here's validation output:

Validation result:
{
  "date": "2024-10-16T09:22:54.668Z",
  "numErrors": 0,
  "numWarnings": 0,
  "numInfos": 1,
  "issues": [
    {
      "type": "CONTENT_VALIDATION_INFO",
      "path": "content/0_0_0.glb",
      "message": "content/0_0_0.glb caused validation infos",
      "severity": "INFO",
      "causes": [
        {
          "type": "CONTENT_VALIDATION_INFO",
          "path": "content/0_0_0.glb",
          "message": "Content content/0_0_0.glb caused validation infos",
          "severity": "INFO",
          "causes": [
            {
              "type": "CONTENT_VALIDATION_INFO",
              "path": "/extensionsUsed/0",
              "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_structural_metadata'.",
              "severity": "INFO"
            },
            {
              "type": "CONTENT_VALIDATION_INFO",
              "path": "/extensionsUsed/1",
              "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_mesh_gpu_instancing'.",
              "severity": "INFO"
            },
            {
              "type": "CONTENT_VALIDATION_INFO",
              "path": "/extensionsUsed/2",
              "message": "Cannot validate an extension as it is not supported by the validator: 'EXT_instance_features'.",
              "severity": "INFO"
            },
            {
              "type": "CONTENT_VALIDATION_INFO",
              "path": "/accessors/3",
              "message": "This object may be unused.",
              "severity": "INFO"
            },
            {
              "type": "CONTENT_VALIDATION_INFO",
              "path": "/accessors/4",
              "message": "This object may be unused.",
              "severity": "INFO"
            }
          ]
        }
      ]
    }
  ]
}

Sample tileset with Box.glb, producing warnings: output.zip

bertt commented 1 month ago

ok, that looks quite simple (one box), better ask on the cesium forum about the warning

Do you also get the warning with the 3 trees? https://bertt.github.io/cesium_3dtiles_samples/samples/1.1/instancing/ https://bertt.github.io/cesium_3dtiles_samples/samples/1.1/instancing/tileset.json

chekhovana commented 1 month ago

ok, that looks quite simple (one box), better ask on the cesium forum about the warning

I will, thank you

Do you also get the warning with the 3 trees? https://bertt.github.io/cesium_3dtiles_samples/samples/1.1/instancing/ https://bertt.github.io/cesium_3dtiles_samples/samples/1.1/instancing/tileset.json

No, there are no warnings while rendering this tileset. I guess there is something wrong with mine tileset, but I don't know how to narrow down the problem (

bertt commented 1 month ago

you can try to set the tags column (all features will have attribute id=0):

update your_table set tags = json_build_array(json_build_object('id',0))

and create the tiles again and see if the warning disappears

chekhovana commented 1 month ago

you can try to set the tags column (all features will have attribute id=0):

update your_table set tags = json_build_array(json_build_object('id',0))

and create the tiles again and see if the warning disappears

This didn't help, so I've experimented a bit and here's what I can observe:

So it's not a problem, as this will not happen with real data.