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

Property tables do not seem to be optional #10000

Closed
javagl opened this issue Jan 8, 2022 · 1 comment
Closed

Property tables do not seem to be optional #10000

javagl opened this issue Jan 8, 2022 · 1 comment

Comments

@javagl
Copy link
Contributor

javagl commented Jan 8, 2022

According to the specification, it should be possible to define feature ID attributes without property tables,

When feature IDs are associated with property tables, then every propertyTables index must have an associated featureIds definition. The propertyTables entry at index i corresponds to the featureIds entry at the same index. As a result, the length of the featureIds array must be greater than or equal to the length of the propertyTables array.

This does not seem to be considered in the current implementation, which directly accesses the propertyTablesArray (which is rather a propertyTableIdsArray, or maybe even a propertyTableIndicesArray, by the way), regardless of whether this array is defined or has the appropriate length.


A glTF asset and the associated tileset are here:

QuadWithFeatureIds.gltf

{
  "extensionsUsed" : [ "EXT_mesh_features" ],
  "accessors" : [ {
    "bufferView" : 0,
    "byteOffset" : 0,
    "componentType" : 5123,
    "count" : 6,
    "type" : "SCALAR",
    "max" : [ 3 ],
    "min" : [ 0 ]
  }, {
    "bufferView" : 1,
    "byteOffset" : 0,
    "componentType" : 5126,
    "count" : 4,
    "type" : "VEC3",
    "max" : [ 1.0, 1.0, 0.0 ],
    "min" : [ 0.0, 0.0, 0.0 ]
  }, {
    "bufferView" : 1,
    "byteOffset" : 48,
    "componentType" : 5126,
    "count" : 4,
    "type" : "VEC3",
    "max" : [ 0.0, 0.0, 1.0 ],
    "min" : [ 0.0, 0.0, 1.0 ]
  }, {
    "bufferView" : 1,
    "byteOffset" : 96,
    "componentType" : 5121,
    "count" : 4,
    "type" : "SCALAR",
    "max" : [ 45 ],
    "min" : [ 12 ]
  } ],
  "asset" : {
    "generator" : "JglTF from https://github.com/javagl/JglTF",
    "version" : "2.0"
  },
  "buffers" : [ {
    "uri" : "data:application/gltf-buffer;base64,AAABAAIAAQADAAIAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAACAPwAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/DAAAAAAAAAAAAAAAFwAAAAAAAAAAAAAAIgAAAAAAAAAAAAAALQAAAAAAAAAAAAAA",
    "byteLength" : 156
  } ],
  "bufferViews" : [ {
    "buffer" : 0,
    "byteOffset" : 0,
    "byteLength" : 12,
    "target" : 34963
  }, {
    "buffer" : 0,
    "byteOffset" : 12,
    "byteLength" : 144,
    "byteStride" : 12,
    "target" : 34962
  } ],
  "materials" : [ {
    "pbrMetallicRoughness" : {
      "baseColorFactor" : [ 0.5, 1.0, 0.5, 1.0 ],
      "metallicFactor" : 0.0,
      "roughnessFactor" : 1.0
    },
    "alphaMode" : "OPAQUE",
    "doubleSided" : false
  } ],
  "meshes" : [ {
    "primitives" : [ {
      "extensions" : {
        "EXT_mesh_features" : {
          "featureIds" : [ {
            "attribute" : 0
          }, {
            "offset" : 5,
            "repeat" : 3
          } ]
        }
      },
      "attributes" : {
        "POSITION" : 1,
        "NORMAL" : 2,
        "FEATURE_ID_0" : 3
      },
      "indices" : 0,
      "material" : 0,
      "mode" : 4
    } ]
  } ],
  "nodes" : [ {
    "mesh" : 0
  } ],
  "scene" : 0,
  "scenes" : [ {
    "nodes" : [ 0 ]
  } ]
}

tileset.json

{
  "asset" : {
    "version" : "1.0"
  },
  "geometricError" : 2.0,
  "root" : {
    "content" : {
      "uri" : "QuadWithFeatureIds.gltf"
    },
    "boundingVolume" : {
      "box" : [ 
        0.5, -0.5, 0.0, 
        0.5, 0.0, 0.0, 
        0.0, -0.5, 0.0, 
        0.0, 0.0, 0.1 ]
    },
    "geometricError" : 1.0
  },
  "extensionsUsed" : [ "3DTILES_content_gltf" ],
  "extensionsRequired" : [ "3DTILES_content_gltf" ]
}

Sandcastle code

(Not cleaned up, just from my local tests...)

Cesium.ExperimentalFeatures.enableModelExperimental = true;

var viewer = new Cesium.Viewer('cesiumContainer');

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    url : 'http://localhost:8003/tilesets/gltf/tileset.json',
    maximumScreenSpaceError: 1,
    debugShowBoundingVolume: true, 
    debugShowGeometricError: true,
    debugWireframe: false,
}));

tileset.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
  Cesium.Cartographic.toCartesian(
    Cesium.Cartographic.fromDegrees(-75.1596759, 39.9509025, 0)));

viewer.camera.frustum.near = 0.1;
viewer.scene.screenSpaceCameraController.minimumZoomDistance = 0.1;
viewer.camera.frustum.fov = 1.5 * Cesium.Math.PI_OVER_THREE;

viewer.zoomTo(tileset);

I tried to address this, to some extent, via javagl@80af1d1 , but the implications of this go into technical details... (BatchTexturePipelineStage#process ... what?!) ... so that I have to give up on that one for now...

@ptrgags
Copy link
Contributor

ptrgags commented Jan 10, 2022

@javagl ah indeed, this should be possible but hasn't been implemented yet (the spec is ahead of the CesiumJS implementation). See #9884

I do think this is an important feature, so hopefully I can get to this soon after the current point cloud work.

@ptrgags ptrgags closed this as completed Jan 10, 2022
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