Cesium: Expose ability to turn off outlines for 3D models?

Created on 15 Jun 2020  路  5Comments  路  Source: CesiumGS/cesium

Came up on the forum here:

It is possible to enable or disable outline dynamically, e.g. using the settings of the cesium itself? I don鈥檛 want to use silhouette for this. I need this solution to control the map and content style.

The PR https://github.com/CesiumGS/cesium/pull/8776 added support for outlines for 3D models with a new glTF extension. This is used on Cesium OSM Buildings:

https://sandcastle.cesium.com/index.html?src=Cesium%20OSM%20Buildings.html

For users who want to control the style of their maps, it may be nice to be able to toggle these outlines on/off. This can be done by adding a new property (perhaps ignoreOutline) in Model.js and threading it through to Cesium3DTileset to ignore this line:

https://github.com/CesiumGS/cesium/blob/e74fa2322817af02308b3689f2f93d61e4e7def3/Source/Scene/Model.js#L5260

The only problem I see here is that this is a bit unusual because the outlines are present because of a property in the glTF, as opposed to a feature of the viewer.

category - graphics type - enhancement

Most helpful comment

Here's a Sandcastle with a small hack to disable the outlines:
https://sandcastle.cesium.com/#c=dVFdb9swDPwrhJ8cwJWTrlvR1Q2GZXtrkWErthe/sBJdC5OlgKLdZUX+e2V7LfaRvZGnu+OR2lC0fadugiG37cVZT9cBDbFqMX78IeSjDR6uoOm9llTmC3gEJunZQ4Mu0iUcal/7ARkGSw/EiezpATaz89cJy+tMT/0meME0hOusgMfaAwgxJ+QTh8GmuW+fhZoJhb4FduZ2puSLovaHxeU0brJVUZMntWPbWbEDRYXG5H8YbGP3vrfOWH8f88URscaOGFXj9rchnxIZimI9jtu+pNkgS6rQv1INh+4D3TNRzE/Oz9RydVHA2VK9uVidFnD+ejnGBAhsKe06u0y+AC3hGOTF9QalVRI+JxR9zE9/SQF2VnT7P9rJM+8w3wOyIqui7B2tZzXAO9vtAgv07HKlSqFu59IxYnnX6+8kSsc4nmKkVuXv0srYAay5OvJfoB3GmF6a3rkv9ifV2boqE/8fqQvTmtuB2OF+pLWr9fUMKqWqMrXHlRKCu0P+y/kJ

The key line is:

Cesium.ModelOutlineLoader.hasExtension = function() { return false; }

All 5 comments

Just to make sure we're solving the right problem, the main issue is not the ability to disable support for the outline glTF extension, but specifically to disable outlines in Cesium OSM Buildings tileset, right?

@kring could probably chime in here but it certainly seems like something we could initially support as the cesium level and then fold into the styling language at a later date (assuming it's not possible to style them already).

Yeah adding it as a property on Cesium3DTileset / Model would be easy enough. Adding it to the styling language would be more work, but not too bad.

In the meantime is there a workaround for this ? I really want to get rid of the outlines in Cesium OSM Buildings

Here's a Sandcastle with a small hack to disable the outlines:
https://sandcastle.cesium.com/#c=dVFdb9swDPwrhJ8cwJWTrlvR1Q2GZXtrkWErthe/sBJdC5OlgKLdZUX+e2V7LfaRvZGnu+OR2lC0fadugiG37cVZT9cBDbFqMX78IeSjDR6uoOm9llTmC3gEJunZQ4Mu0iUcal/7ARkGSw/EiezpATaz89cJy+tMT/0meME0hOusgMfaAwgxJ+QTh8GmuW+fhZoJhb4FduZ2puSLovaHxeU0brJVUZMntWPbWbEDRYXG5H8YbGP3vrfOWH8f88URscaOGFXj9rchnxIZimI9jtu+pNkgS6rQv1INh+4D3TNRzE/Oz9RydVHA2VK9uVidFnD+ejnGBAhsKe06u0y+AC3hGOTF9QalVRI+JxR9zE9/SQF2VnT7P9rJM+8w3wOyIqui7B2tZzXAO9vtAgv07HKlSqFu59IxYnnX6+8kSsc4nmKkVuXv0srYAay5OvJfoB3GmF6a3rkv9ifV2boqE/8fqQvTmtuB2OF+pLWr9fUMKqWqMrXHlRKCu0P+y/kJ

The key line is:

Cesium.ModelOutlineLoader.hasExtension = function() { return false; }

Amazing ! Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pjcozzi picture pjcozzi  路  4Comments

hpinkos picture hpinkos  路  4Comments

pjcozzi picture pjcozzi  路  4Comments

worlddai picture worlddai  路  3Comments

GatorScott picture GatorScott  路  3Comments