Here what I got at the moment

Copy/paste code below into Cesium/Sandcastle editor and run:

var cesiumViewer = new Cesium.Viewer('cesiumContainer',

{

terrainProvider: new Cesium.CesiumTerrainProvider({ url: '//assets.agi.com/stk-terrain/world' })

, baseLayerPicker: false

});

drawPolylineOnTerrain();

function drawPolylineOnTerrain() {

var polylinePoints =

[

{lng:150.644, lat:-34.397},

{lng:150.644, lat:-35.397},

{lng:156.644, lat:-35.397},

{lng:156.644, lat:-36.397},

{lng:158.644, lat:-37.397},

{lng:160.644, lat:-39.397}

];

var polylinePointsExtended = extendWithIntermediatePoints(polylinePoints);

Cesium.when(Cesium.sampleTerrain(cesiumViewer.terrainProvider, 9, polylinePointsExtended), sampleTerrainSuccess);

}

function extendWithIntermediatePoints(polylinePoints) {

var extendedPoints = ;

var previousPoint = polylinePoints[0];

extendedPoints.push(Cesium.Cartographic.fromDegrees(previousPoint.lng, previousPoint.lat));

var minDistance = 0.001;

for (var i = 1; i < polylinePoints.length; i++) {

var current = polylinePoints[i];

var lngDiff = current.lng - previousPoint.lng;

var latDiff = current.lat - previousPoint.lat;

var max = Math.max(Math.abs(lngDiff), Math.abs(latDiff));

var pointCount = parseInt(max / minDistance, 10);

var lngIncrement = lngDiff / (pointCount ? pointCount : 1);

var latIncrement = latDiff / (pointCount ? pointCount : 1);

var count = 1;

while (count <= pointCount) {

extendedPoints.push(Cesium.Cartographic.fromDegrees(previousPoint.lng + count * lngIncrement, previousPoint.lat + count * latIncrement));

count++;

}

extendedPoints.push(Cesium.Cartographic.fromDegrees(current.lng, current.lat));

previousPoint = current;

}

return extendedPoints;

}

function sampleTerrainSuccess(sampleTerrainPoints) {

var updatedPolyLinePoints = ;

for (var i = 0; i < sampleTerrainPoints.length; ++i) {

var updatedPoint = sampleTerrainPoints[i];

updatedPolyLinePoints.push(Cesium.Math.toDegrees(updatedPoint.longitude), Cesium.Math.toDegrees(updatedPoint.latitude), updatedPoint.height);

}

function computeCircle(radius) {

var positions = ;

for (var i = 0; i < 360; i++) {

var radians = Cesium.Math.toRadians(i);

positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));

}

return positions;

}

cesiumViewer.entities.add({

//polylineVolume:

polyline: {

positions: Cesium.Cartesian3.fromDegreesArrayHeights(updatedPolyLinePoints),

//shape :computeCircle(1000),

width:5,

material: Cesium.Color.BLACK

}

});

cesiumViewer.zoomTo(cesiumViewer.entities);

}