Height Reference above Terrain for Long objects

We have a long 3D object (Say a water hose of 100 FT) which needs to be displayed on Terrain loaded with a reference height above the terrain. Currently I'm loading the entity as below,

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
        url: ‘https://assets.agi.com/stk-terrain/world’,
        requestWaterMask: true,
        requestVertexNormals: true
viewer.terrainProvider = cesiumTerrainProviderMeshes;

var entity = viewer.entities.add({
        name : url,
        position : position,
        orientation : orientation,
        model : {
            uri : url,
             heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
            minimumPixelSize : 0,
            maximumScale : 100,
            scale: 1.79
    viewer.trackedEntity = entity;

Problem here is on a FLAT land everything is working fine but as terrain loaded and if the region of interest is loaded with slopes One end of hose is above ground and other end of hose is falling on the terrain.

Here is an example, I need to display hose 10m above the ground and region of interest has a slope field with change is the altitude of 8m from start to end. When the 3D model is loaded, starting edge of Hose is 10m above the ground where as end of the model is just 2m of the ground, where I need to display the model with orientation of 10m all the way.

Please help in achieving this. Any help would be greatly appreciated!!!

Shiva Kumar.

As of now 3D models do not conform to terrain, only their origin is clamped to terrain. This is a pretty challenging problem that we just haven’t gotten to yet.

Hello everyone,
This is a long pending implementation from Cesium and I’m still looking for answers. is there any way to accomplish this?


Shiva Kumar.

Sorry, no update on this yet.

Hi Sean,
do we have this in pipeline?

Shiva Kumar.

At the moment it’s not high priority.

For the Cesium team it was easier for us to get around this problem on the data generation side by extruding the floor vertices, or adding “skirts”. Maybe we will have a runtime version of this in the future, but I don’t know when that would be.

Thanks Sean. Will be watching out this space.

Shiva Kumar.

Hi there,
I did see lots of new features being developed in cesium and with the latest version of 1.52, I believe the above-said problem can be resolved using examples of "Clamp to 3D Tiles" and "Sample Height from 3D Tiles".
But the question is our application is used to place objects anywhere on the Globe and I assume the examples would work only if we have 3D tileset for the corresponding location.
Would there be any alternative for 3D tileset, can a terrain provider component be used to have these clamping option?

Shiva Kumar.

The answer is yes! You can use the sampleTerrainMostDetailed and the sampleTerrain functions to get the height at any particular point on the globe.

Let me know if that works for you.