Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnts to glb with clasification #67

Open
vkitor opened this issue Sep 14, 2023 · 2 comments
Open

pnts to glb with clasification #67

vkitor opened this issue Sep 14, 2023 · 2 comments

Comments

@vkitor
Copy link

vkitor commented Sep 14, 2023

Hi,
I have a classified point cloud dataset in .pnts format.
I tried using the upgrade command to convert pnts dataset to glb, but it seems that I've lost the classification attribute in the process.

When I use the analyse tool on .glb file, it mentions classification attribute, but when I open the dataset in Cesium viewer, I get no preview when I apply the classification style.

Is there another way to convert point cloud to glb, or is this the issue with Cesium viewer?

Thank you

I did conversion using following command:
npx 3d-tiles-tools upgrade --targetVersion 1.1 -i path/to/pnts/dataset/tileset.json -o ./output/upgraded

This is the result of analyse command:

{
  "asset": {
    "generator": "glTF-Transform",
    "version": "2.0"
  },
  "accessors": [
    {
      "type": "VEC3",
      "componentType": 5126,
      "count": 8277,
      "max": [
        17.905780792236328,
        11.288053512573242,
        0.07561510056257248
      ],
      "min": [
        17.62045669555664,
        11.036800384521484,
        -0.08327221870422363
      ],
      "bufferView": 0,
      "byteOffset": 0
    },
    {
      "type": "SCALAR",
      "componentType": 5121,
      "count": 8277,
      "bufferView": 0,
      "byteOffset": 12
    }
  ],
  "bufferViews": [
    {
      "buffer": 0,
      "byteOffset": 0,
      "byteLength": 132432,
      "byteStride": 16,
      "target": 34962
    }
  ],
  "buffers": [
    {
      "byteLength": 132432
    }
  ],
  "materials": [
    {
      "pbrMetallicRoughness": {
        "metallicFactor": 0
      }
    }
  ],
  "meshes": [
    {
      "primitives": [
        {
          "attributes": {
            "POSITION": 0,
            "_CLASSIFICATION": 1
          },
          "mode": 0,
          "material": 0,
          "extensions": {
            "EXT_structural_metadata": {
              "propertyAttributes": [
                0
              ]
            }
          }
        }
      ]
    }
  ],
  "nodes": [
    {
      "rotation": [
        -0.7071067811865475,
        0,
        0,
        0.7071067811865476
      ],
      "mesh": 0
    }
  ],
  "scenes": [
    {
      "nodes": [
        0
      ]
    }
  ],
  "extensionsUsed": [
    "EXT_structural_metadata"
  ],
  "extensions": {
    "EXT_structural_metadata": {
      "schema": {
        "id": "ID_batch_table",
        "name": "Generated from batch_table",
        "classes": {
          "class_batch_table": {
            "name": "Generated from batch_table",
            "properties": {
              "Classification": {
                "name": "Classification",
                "description": "Generated from Classification",
                "type": "SCALAR",
                "componentType": "UINT8",
                "required": true
              }
            }
          }
        }
      },
      "propertyAttributes": [
        {
          "class": "class_batch_table",
          "properties": {
            "Classification": {
              "attribute": "_CLASSIFICATION"
            }
          }
        }
      ]
    }
  }
}
@vkitor
Copy link
Author

vkitor commented Sep 15, 2023

@javagl
Copy link
Contributor

javagl commented Sep 15, 2023

Thanks for providing the test data for this case.

The output includes the metadata extension, and the class_batch_table with its Classification property, suggesting that the conversion worked in principle.

I have created two tileset...json files for the PNTS and the GLB, and a small sandcastle to look at them. The style that is applied there in both cases is the following:

  currentTileset.style = new Cesium.Cesium3DTileStyle({
    color: {
      conditions: [
        ["${Classification} === 5", "color('green')"],
        ["true", "color('red')"],
      ],
    },
  });

The following is a small screengrab from this sandcastle:

Cesium ToolsIssue67

One can see that in the PNTS case, the style is applied properly (all points are green). In the GLB case, all points are black initially. But... when (enabling the 3D Tiles inspector and) hovering over the content, it does display the style.

So... the information seems to be translated properly but not displayed. I have opened CesiumGS/cesium#11520 for further investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants