# Generate 3D tiles in CPP

**URL:** <https://community.cesium.com/t/generate-3d-tiles-in-cpp/39401>\
**Category:** 3D Tiles\
**Created:** [March 19, 2025, 11:39am UTC](https://community.cesium.com/t/generate-3d-tiles-in-cpp/39401 "2025-03-19T11:39:02Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Marco13](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/marco13/32/2757_2.png) [@Marco13](https://community.cesium.com/u/Marco13)\
**Post date:** [March 19, 2025, 1:37pm UTC](https://community.cesium.com/t/generate-3d-tiles-in-cpp/39401/4 "2025-03-19T13:37:53Z")

</div>

Coincidentally, it looks like the reason here is the same as in [another recent thread](https://community.cesium.com/t/implicit-tiling-file-format-help/38926/8): The PNTS file contains the vertices “centered at the origin”. The tileset JSON defines a bounding _region_, which is a place at the surface of the earth. So this just does not match.

I have not yet looked at the code that you posted. My first hint for debugging would have been what you apparently tried out later, namely, actually writing the data into _files_ (which are much easier to analyze than a server that generates the data on the fly). But you might want to check the computation of the bounding region. I think that adding a `root.transform` in the tileset JSON (as described in the linked thread) might solve this issue here as well.

Just from a local experiment: Here is a tileset JSON that uses a bounding **box** :

```json
{
  "asset": {
    "version": "1.1"
  },
  "geometricError": 4096,
  "root": {
    "boundingVolume": {
      "box": [
        0,
        0,
        3500,
        5955.3779296875,
        0,
        0,
        0,
        3114.458740234375,
        0,
        0,
        0,
        500
      ]
    },
    "geometricError": 512,
    "content": {
      "uri": "content.pnts"
    },
    "refine": "ADD"
  }
}

```

And that can be displayed with this sandcastle, which _manually_ places the tileset at a certain position on the globe:

```javascript
const viewer = new Cesium.Viewer("cesiumContainer");

// Create the tileset in the viewer
const tileset = viewer.scene.primitives.add(
  await Cesium.Cesium3DTileset.fromUrl(
    "http://localhost:8080/tileset-new.json", {
    debugShowBoundingVolume: true,
  })
);

// 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;

// Zoom to the tileset, with a small offset so that
// it is fully visible
const offset = new Cesium.HeadingPitchRange(
  Cesium.Math.toRadians(-22.5),
  Cesium.Math.toRadians(-22.5),
  60.0
);
viewer.zoomTo(tileset, offset);

```

---

_[View the full topic](https://community.cesium.com/t/generate-3d-tiles-in-cpp/39401)._
