Clamp CZML 3d Models to terrain

I tried to search for this issue throughout the forum but couldn’t make out any answer. How to clamp the 3d models created from czml document to terrain ?

Hello,

This is something we plan on supporting in the future, but we do not currently have a way to do this.

Best,

Hannah

It is supported now in release 1.23? I am trying to clamp CZML polygon to terrain.

Hello,

Yes, both polygons on terrain and models on terrain have been added in 1.23

Best,

Hannah

Thanks Hannah!
Can you give an example for clamping the polygon to terrain using CZML? I could not find any documentation for it.

I tried to use heightReference attribute with value Cesium.HeightReference.CLAMP_TO_GROUND for polygon as I found it for entities but it is not working.

Thanks in advance :slight_smile:

No problem =)
For polygons, ellipses and similar ground geoemetry types, you don’t need to do anything extra. They will be drawn on terrain as long as they have a per instance color material type.

For billboards and models, you need to specify a heightReference.

For more info, there is a short explanation in CHANGES for the 1.23 release

-Hannah

It would be great if you could provide CZML example of the same. Setting heightReference attribute is not helping. On page load polygon do not float but if I change the terrain to STK World terrain, the polygon floats and does not keep clamped to floor.

Polygons should be clamped to the terrain automatically for CZML too, as long as you don’t give it a height,extruded height or perPositionHeight.
If it’s not working, could you provide a sample I could test with?

Thanks

-Hannah

Thanks Hannah!!!

I am adding height and extrudedHeight attributes to the polygons.

I wish to display the polygons clamped to terrain but also wish to keep their height and extrudedHeight attributes as they are. Is there any solution available to resolve this?

Sorry, unfortunately that is not available at this time. That is something we’d like to add in the future, but there’s a bit more research for us to do in order to make sure the geometry renders efficiently.

-Hannah

Thanks Hannah,

Can this functionality be expected working in next release? If no, when will it be available? I am very much eager to implement it in my project :slight_smile:

Hi Hannah, can you elaborate on the research challenges further? The inability to clamp geometry with height to terrain in Cesium is a major drawback to the software and makes modelling in urban environments with even moderate terrain pointless with Cesium.

Also, it would be helpful if the version release notes were more detailed so developers don’t waste time trying to use announced functionality that isn’t actually there…

Thanks,

Greg

Sorry, I’m not sure about the exact details. It may be a little while before we have a chance to revisit this. We’re currently focused on finishing up implementing the new 3D tiles specification.

-Hannah

We actually don’t generate a mesh that conforms to terrain. We use a screen space technique that requires the terrain to be already be rendered. Having geometries at height would require the terrain to be rendered an additional time per geometry, which could drastically impact performance. What is your use case for having polygons in the air but still conforming to terrain?

The release notes for 1.23 explicitly say that geometries will only be clamped to terrain if they don’t have a height or extruded height.

“Changed corridor, ellipse, polygon and rectangle entities to conform to terrain by using a GroundPrimitive if its material is a ColorMaterialProperty instance and it doesn’t have a height or extrudedHeight. Entities with any other type of material are not clamped to terrain.”

–Tom

Hi Tom, we’re just trying to draw CZML rectangular prisms on a hillside and have them clamped to ground when terrain is enabled. Imagine buildings on a hill in San Francisco. Simple to do with KML, do you think we can do it with Cesium?

Thanks,

Greg