Model lost in 3dtiles

i use 2 gltf model to make 3dtiles for test,but the tile only show one airplane model,another model disappear
image

i see the document Tiler Data Types and Formats saying:
If you add multiple models at the same time, they will be merged into a single asset.

how can i resolve it,and whether if i can specify each model position in the tiles

Well… the box is still there:

Cesium Two Gltfs

The problem is that there is no information about where exactly each model should be (relative to each other).

There are different possible solutions for this. For a single example, you could edit the glTF file manually. For the BoxUnlit.gltf, it’s relatively easy. It contains a single node, and this node already has a matrix. You could edit this matrix, to describe a translation about (10,10,10)

            "matrix": [
                1.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                -1.0,
                0.0,
                0.0,
                1.0,
                0.0,
                0.0,
                10.0,
                10.0,
                10.0,
                1.0
            ]

(Note that the matrix also contains an up-axis transform, but that doesn’t matter right now)

The result would be the following:

Cesium Two Gltfs 2

But of course, this does not scale so well. I think that the solution will depend on 1. how many glTF assets you have, and 2. how you want to assign the different positions for each of them.

thank you for your reply,i want to distinct each gltf in the tile,and i add extra data in box gltf , but when i pick the box gltf in cesium ,i can not see it

{
"extras" : { "description" : "my description 2" }
}

how i can add some metadata or featureID to gltf so i can use them in cesium,can you give me some document on how cesium transform gltf into 3dtiles

cesium transform gltf into 3dtiles

The process for converting glTF assets into 3D Tiles is not trivial. Depending on the type, structure, and size of the input glTF asset, the asset may be split into multiple parts, to support efficient streaming and Level-Of-Detail.

Therefore, there currently is no way to explicitly transport metadata from an input glTF through the tiling process and let it appear in the output.

If your goal is only to combine a set of glTF assets into a single tileset.json, then you could have a look at How to generate tileset.json · Issue #47 · CesiumGS/3d-tiles-tools · GitHub and the corresponding pull request at Generate tileset JSON from content files by javagl · Pull Request #51 · CesiumGS/3d-tiles-tools · GitHub . This is currently only marked as a ‘Draft’, but could already be helpful for your goal: It adds a functionality where
npx ts-node ./src/main.ts createTilesetJson -i C:/inputFiles -o C:/tileset.json
creates a tileset.json that refers to all input glTF files. These glTF files can also contain metadata, but when each object is retained in the tileset, then you may not even need the metadata to identify the different objects.

i download the branch ‘tileset-json-creation’ and run the command npx ts-node ./src/main.ts createTilesetJson,the terminal show

what i want to do is that a building Collection shake in Hurricane,each building shake differently because their height or material,the shake is made by change verticle position in shader,and the building data come from Oblique photography

i split this goal to some steps,one is to distinct each building,and now the document show only featureId can get in the shader

in this example,serveral building share same featureId,so i try to make tiles from gltf by myself to test add featureId to each building

From a quick look: Did you run
npm install
after cloning it?

If you did, I’ll have to check that branch and see whether a dependency might be missing.

yes,i run it.

can i modidy the @gltf-transform version define in package.json to make it work?

I don’t know if the version is the problem here. The package.json contains the line
"@gltf-transform/functions": "^3.2.1",
in the dependencies. If you think that it would work with a different version, then you can try it out. But for now, the error message looks like it didn’t find the dependency at all.

I just tried it out, with a fresh clone of the repository, and the tileset-json-creation branch, and after the npm install, the command
npx ts-node ./src/main.ts createTilesetJson -i ./input -o ./tileset.json
did work for me.

The console in your screenshot shows a strange command, namely

...cmd.exe /d /s /c  "ts-node "src\main.ts" ... tileset.json""
                     ^        ^           ^                  ^
                     |        |-----------|                  |
                     |         quotes here                   |
                     |---------------------------------------|
                        quotes around everything here          

and I don’t know what the /d /s /c part there is to begin with.

What does it print when you just type

npx -version

at the console?

@gltf-transform/functions is the same as ^3.2.1


i run the command the same as you and my working directory is now like

  • src
    • input
      • BoxUnlit1.gltf
    • main.ts
    • a.ts

npx -version is 7.0.3 node version is 15.0.1 ,also i run a.ts,it work well when import some module from “@gltf-transform/core”


the import error only show in @gltf-transform/functions

@gltf-transform.zip (1.0 MB)
i upload the @gltf-transform which i have deleted and download from npm again @Marco13

Right now, I have no idea what might be causing this.

Does the last example work when you explicitly call
npm install --save @gltf-transform/functions
?

(It should not make a difference, … but I can not do much more than make guesses right now…)

i notice @gltf-transform/core will be installed when i install @gltf-transform/functions alone,so i install core-extensions-functions step by step,it work and i generate tileset successfully

tileset.zip (790.9 KB)

a new problem is that the model disapper after some movement such as zoom in/out

a new problem is that the model disapper after some movement such as zoom in/out

I tried out the tileset that you attached, and could not reproduce this.

To clarify:

  • Does the model only disappear when you zoom out very far?
  • The important point: Does it disappear “forever”, or can you make it re-appear when you zoom back to the original view position?

(Are you doing anything “unusual” when loading the tileset, like setting a special maximum screen space error or so…?)

const tileset = await Cesium.Cesium3DTileset.fromUrl(“http://127.0.0.1:5500/tileset.json”);

the model disapper after any movement and can not appear again when i do some reverse operation

also , if i use the api

const tileset = new Cesium.Cesium3DTileset({
url: “http://127.0.0.1:5500/tileset.json”,
});

it throw TypeError: Cannot read properties of undefined (reading ‘updateTransform’)

I think that the reason for the behavior is that the tileset does not have a sensible position. It is basically located at the center of the earth, and the standard interactions (rotating and zooming) don’t work so well in that case.

You could put the tileset at a certain position on the surface of the earth, by setting its modelMatrix, like this:

const viewer = new Cesium.Viewer("cesiumContainer");
const tileset = viewer.scene.primitives.add(
  await Cesium.Cesium3DTileset.fromUrl(
    "http://localhost:8003/tileset.json")
);

// Move the tileset to a certain position on the globe
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(
  Cesium.Cartesian3.fromDegrees(-75.152408, 39.946975, 20)
);
const scale = 1.0;
const modelMatrix = Cesium.Matrix4.multiplyByUniformScale(
  transform,
  scale,
  new Cesium.Matrix4()
);
tileset.modelMatrix = modelMatrix;

viewer.zoomTo(tileset);

also , if i use the api. […] it throw TypeError:

Yes, this due to an API change in version 1.107. For details, refer to CesiumJS Ready Promise Deprecation / API Changes