# Why Is My 3D Tileset Not Aligning Correctly with Terrain in CesiumJS?

**URL:** <https://community.cesium.com/t/why-is-my-3d-tileset-not-aligning-correctly-with-terrain-in-cesiumjs/42186>\
**Category:** CesiumJS\
**Created:** [July 20, 2025, 2:10pm UTC](https://community.cesium.com/t/why-is-my-3d-tileset-not-aligning-correctly-with-terrain-in-cesiumjs/42186 "2025-07-20T14:10:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevediaz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/stevediaz/32/27346_2.png) [@stevediaz](https://community.cesium.com/u/stevediaz)\
**Post date:** [July 20, 2025, 2:10pm UTC](https://community.cesium.com/t/why-is-my-3d-tileset-not-aligning-correctly-with-terrain-in-cesiumjs/42186/1 "2025-07-20T14:10:04Z")

</div>

Hello

I have successfully loaded a custom 3D Tileset (converted from CityGML) into CesiumJS but the tiles appear slightly floating / sunken relative to the terrain; even though I have applied a georeferenced bounding volume & ensured the tile set is positioned with appropriate `RTC_CENTER`/`transform`. 🙂 Interestingly; the issue becomes more noticeable when zooming in or switching terrain providers (e.g., Cesium World Terrain vs. custom terrain). 🙃

I have verified the tile coordinate system (EPSG:4978) & used tools like `3d-tiles-tools` to inspect the tileset’s transform metadata. Even manually tweaking the transform matrix doesn’t produce a reliable fix it either overcorrects or breaks level-of-detail rendering. 🤔

The same tileset aligns correctly in other engines; so I am wondering if Cesium’s terrain exaggeration / terrain clamping behavior might be interfering. 🤔I checked [Styling and Filtering 3D Tiles – Cesium](https://cesium.com/learn/cesiumjs-learn/cesiumjs-3d-tiles-styling/) guide for reference . Working with CesiumJS has deepened my understanding of [what is javascript](https://www.igmguru.com/blog/what-is-javascript), especially when debugging transform logic & 3D content alignment issues. 🤔

Is there a best practice for aligning tilesets precisely with varying terrain? Should I consider disabling terrain or using `heightReference: NONE`, / is the 🤔re a specific transform strategy that ensures better Z-alignment regardless of terrain source?

Thank you !! 🙂

---

<div class="post-metadata">

**Author:** ![jjhembd](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jjhembd/32/10144_2.png) [@jjhembd](https://community.cesium.com/u/jjhembd)\
**Post date:** [July 21, 2025, 8:05pm UTC](https://community.cesium.com/t/why-is-my-3d-tileset-not-aligning-correctly-with-terrain-in-cesiumjs/42186/2 "2025-07-21T20:05:39Z")

</div>

Hi @stevediaz, welcome to the community!

In your input CityGML file, what are the elevations measured from? Are they heights above sea level, or heights above the WGS84 ellipsoid?

CesiumJS uses heights that are referenced to the WGS84 ellipsoid. See this [previous thread on terrain elevations](https://community.cesium.com/t/elevation-data-from-cesium-terrain-providers-is-wrong/1654/4) for more discussion.

If you can estimate the vertical error that you are seeing at a given longitude/latitude, we could get a quick check of whether the geoid vs ellipsoid error is enough to explain it.
