# Points are being cut off by tileset

**URL:** <https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579>\
**Category:** CesiumJS\
**Created:** [April 18, 2024, 5:55pm UTC](https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579 "2024-04-18T17:55:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mechobba](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mechobba/32/23069_2.png) [@mechobba](https://community.cesium.com/u/mechobba)\
**Post date:** [April 18, 2024, 5:55pm UTC](https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579/1 "2024-04-18T17:55:48Z")

</div>

I’m new to Cesium, and I’ve dug around a lot but I can’t find a solution that works for me. I’ve pulled together everything I want in [this sandbox](https://sandcastle.cesium.com/#c=5VXbbts4EP2VgbFA5YVCS740ruMEmya9BEjiInE3xcJASktjmyhFCiR9yRb59x2KluM0fevTovKDSc6ZwzOHIyrTyjpYCVyjgWNQuIYztGJZsL+rtWjSyKr5mVaOC4Vm0ojh+0QBzKWe4gBmXFqMJ+qxeTRRWUVnM1RIbIGWVVMK+l+rBSOK3WkjcxijMcQJb7lF+ODpoDR6JXLMYfoAV3zDzURJdOCERIuOSJx5CNsT09Xpl9MbGN2N4e79e0hZe4/JQ7ZZpISvuXB1ZeGvcz4OYTYzurjQ6tTS5CKP0nbSb7853FYJUPCNKJbFbWYQ1W3JM3xnjDYD6MYeUNUNoWZWGlEIJ1ZoGc/zaCvAIx4h4y5bQIQ+uRnIvV1aIpN6Hn2tWEFqngs1r7UP4I/vVcbj14pl5yJfOm20444qXXED1VhoEojk3jEkLEmPQkhy6671mhbPCc6UXkeea/90WKmtu0GV0wIJf7dC5S6FdRQy0WypMk8NUYWNSVuB2wo8v3rJHQK2FOqGlin6TN4OkKN0nKKRpziohTahBWmSJBXsSTxhQuK+7owXaDgLTkT1AXPjaMRVh32+vhjf/xM/SfkzbFqZ2XxqylIL5ezOFCqfjnF7ilWhZJDwBQzg5Sa+gc5xTv1ho4PDHuu9OTyk/unSGXT6/U4zDgS0w6BuqgWK+YIcn6FBlSHsaD8+D7Czy9OrT/fj0f2Hm9Hn6/M4pGda+g6spfhZpeLM2mpy6ww1UfTKzKc8avd6MbQ7nRjSLslK2Ovmq+aWqBQblLfiX3qR20no5/pd/nUr+gmjnTs9lnZ/Zw/SNm3dY93X/0sTGnFjaN2DxJMABPhLFKU2DpZGRoy1HBalpFfLtqbL7Bvdp5m14Q7wj+NTifFutnga5rUF/plqQ3fPANJyA3QlihzWC+Hw6EfEARUseWlJZj3aYR531G6fuqRDIw8G0C83P2KHrf3ShrlYgciPf/LNg4wuIkuR2VJWNk0aJ8MW4V+kbi/w0QqN5A8etkhPLsMiY2zYounPM53WckpfvOfM/wE) except that the tileset is interfering with the points I want to display. What am I missing?

My code:

```auto
const viewer = new Cesium.Viewer("cesiumContainer", {
  globe: false,
});
const scene = viewer.scene;

// One World Terrain Base Globe provided by Maxar
let tileset;
try {
  // MAXAR OWT WFF 1.2 Base Globe
  tileset = await Cesium.Cesium3DTileset.fromIonAssetId(1208297, {
    maximumScreenSpaceError: 4,
  });
  scene.primitives.add(tileset);
} catch (error) {
  console.log(`Error loading tileset: ${error}`);
}

// autorotate
var rotationSpeed = 0.01;
var lastNow = Date.now();
viewer.scene.postRender.addEventListener(function (scene, time) {
  var now = Date.now();
  var spinRate = rotationSpeed;
  var delta = (now - lastNow) / 1000;
  lastNow = now;
  viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT_Z, spinRate * delta);
});

// points
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
  point: {
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
    color: Cesium.Color.fromCssColorString('rgba(255, 233, 147, 0.6)'),
    pixelSize: 20,
  },
});
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-80.5, 35.14),
  point: {
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
    color: Cesium.Color.fromCssColorString('rgba(255, 233, 147, 0.6)'),
    pixelSize: 20,
  },
});
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-80.12, 25.46),
  point: {
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
    color: Cesium.Color.fromCssColorString('rgba(255, 233, 147, 0.6)'),
    pixelSize: 20,
  },
});

```

---

<div class="post-metadata">

**Author:** ![azrogers](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/azrogers/32/21672_2.png) [@azrogers](https://community.cesium.com/u/azrogers)\
**Post date:** [April 19, 2024, 3:23pm UTC](https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579/2 "2024-04-19T15:23:45Z")

</div>

Hi @mechobba, welcome to the forums! I’m guessing you’re referring to the points you want to display intersecting with the earth? One option you have to solve this is to set the `disableDepthTestDistance` property on each point to `Number.POSITIVE_INFINITY`, which will make the points ignore depth testing and never clip:

```auto

// points
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
  point: {
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
    color: Cesium.Color.fromCssColorString('rgba(255, 233, 147, 0.6)'),
    pixelSize: 20,
    disableDepthTestDistance: Number.POSITIVE_INFINITY
  },
});
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-80.5, 35.14),
  point: {
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
    color: Cesium.Color.fromCssColorString('rgba(255, 233, 147, 0.6)'),
    pixelSize: 20,
    disableDepthTestDistance: Number.POSITIVE_INFINITY
  },
});
viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-80.12, 25.46),
  point: {
    heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
    color: Cesium.Color.fromCssColorString('rgba(255, 233, 147, 0.6)'),
    pixelSize: 20,
    disableDepthTestDistance: Number.POSITIVE_INFINITY
  },

```

---

<div class="post-metadata">

**Author:** ![mechobba](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mechobba/32/23069_2.png) [@mechobba](https://community.cesium.com/u/mechobba)\
**Post date:** [April 26, 2024, 1:35pm UTC](https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579/3 "2024-04-26T13:35:43Z")

</div>

That worked perfectly! But… now I can still see the points even when they are on the other side of the globe.

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [April 26, 2024, 8:24pm UTC](https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579/5 "2024-04-26T20:24:58Z")

</div>

Hi @mechobba!

A few thoughts:

1. `CLAMP_TO_GROUND` does not work by default with 3D Tiles (which is what you are using for the base globe). To enable it, pass the `enableCollision` option:

```js
  tileset = await Cesium.Cesium3DTileset.fromIonAssetId(1208297, {
    maximumScreenSpaceError: 4,
    enableCollision: true
  });

```

1. Even then, the points are probably too close to the terrain, and will still clip. You could use `HeightReference.RELATIVE_TO_GROUND` instead, and include a height value with your position like `Cartesian3.fromDegrees(-80.5, 35.14, 10000)`.

2. But I think the cleanest solution here would be to use a `CallbackProperty` with `disableDepthTestDistance`. We’ll make sure the depth test distance is always the distance from the camera to the center of the earth, so that points on the other side don’t show through:

```js
    disableDepthTestDistance: new Cesium.CallbackProperty(() => viewer.scene.camera.getMagnitude(), false)

```

---

<div class="post-metadata">

**Author:** ![mechobba](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mechobba/32/23069_2.png) [@mechobba](https://community.cesium.com/u/mechobba)\
**Post date:** [April 30, 2024, 12:57pm UTC](https://community.cesium.com/t/points-are-being-cut-off-by-tileset/31579/6 "2024-04-30T12:57:52Z")

</div>

That worked perfectly! Thank you!
