# Is it possible to show primitives to terrain(to DEM)?

**URL:** <https://community.cesium.com/t/is-it-possible-to-show-primitives-to-terrain-to-dem/15245>\
**Category:** CesiumJS\
**Created:** [September 13, 2021, 5:55am UTC](https://community.cesium.com/t/is-it-possible-to-show-primitives-to-terrain-to-dem/15245 "2021-09-13T05:55:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shashi](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/shashi/32/3649_2.png) [@Shashi](https://community.cesium.com/u/Shashi)\
**Post date:** [September 13, 2021, 5:55am UTC](https://community.cesium.com/t/is-it-possible-to-show-primitives-to-terrain-to-dem/15245/1 "2021-09-13T05:55:42Z")

</div>

Dear Team,  
I’ve created a toolbar to draw points, lines, and polygons using primitives and it’s not visible on the terrain.  
If I’m using entities with RELATIVE\_TO\_HEIGHT it’s working but not with primitives. Is there any other way to show primitives on the terrain if so please give me a suggestion?  
Sample is given bellow:-  
var b = new Cesium.BillboardCollection();  
scene.primitives.add(b);  
var billboard = b.add({  
show: true,  
position: event.position,  
pixelOffset: new Cesium.Cartesian2(0, 0),  
eyeOffset: new Cesium.Cartesian3(0.0, 0.0, 0.0),  
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,  
verticalOrigin: Cesium.VerticalOrigin.CENTER,  
//heightReference: Cesium.HeightReference.RELATIVE\_TO\_GROUND,  
// heightReference: Cesium.HeightReference.CLAMP\_TO\_GROUND,  
// disableDepthTestDistance: Number.POSITIVE\_INFINITY,  
scale: 1.0,  
image: ‘assets/icon/icons8-marker-24.png’,  
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),  
});  
billboard.setEditable();  
$(‘.button’).css(‘background’, ‘#fff’);

Thanks

---

<div class="post-metadata">

**Author:** ![sam.rothstein](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sam.rothstein/32/6584_2.png) [@sam.rothstein](https://community.cesium.com/u/sam.rothstein)\
**Post date:** [September 14, 2021, 2:39pm UTC](https://community.cesium.com/t/is-it-possible-to-show-primitives-to-terrain-to-dem/15245/2 "2021-09-14T14:39:16Z")

</div>

@Shashi

`scene.primitives.add(b);` looks correct to me. Are you experiencing any errors that make you want to find another method to add primitives?

-Sam

---

<div class="post-metadata">

**Author:** ![Shashi](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/shashi/32/3649_2.png) [@Shashi](https://community.cesium.com/u/Shashi)\
**Post date:** [September 15, 2021, 4:26am UTC](https://community.cesium.com/t/is-it-possible-to-show-primitives-to-terrain-to-dem/15245/3 "2021-09-15T04:26:42Z")

</div>

@sam.rothstein  
It’s sloved! I was missing initialization of scene in billboard. Like before i was using var b = new Cesium.BillboardCollection(); but it should be var b = new Cesium.BillboardCollection(cesium:viewer.cesium);

Thanks

---

<div class="post-metadata">

**Author:** ![sam.rothstein](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/sam.rothstein/32/6584_2.png) [@sam.rothstein](https://community.cesium.com/u/sam.rothstein)\
**Post date:** [September 16, 2021, 2:21pm UTC](https://community.cesium.com/t/is-it-possible-to-show-primitives-to-terrain-to-dem/15245/4 "2021-09-16T14:21:29Z")

</div>

@Shashi

I am very happy to hear this! Thank you for updating the thread with your solution 😀 🚀

-Sam
