Geometry with custom triangles/normals

Hi,

I have custom 3D geometry that is already split into indexed triangles with pre-calculated normals. What is the best way to get this data into cesium. I looked at the polygon entities but that seems like it just takes a raw set of points and does triangulation on the points.

Thanks for the help.

Hello,

I don’t think there isn’t anything built into Cesium that would handle this kind of input. You could write your own Custom Geometry to handle this.

This tutorial might be a little out of date, but it will give you a good idea of how to write a custom geometry type: https://github.com/AnalyticalGraphicsInc/cesium/wiki/Geometry-and-Appearances

You can also find more information about Geometry and Appearances here: http://cesiumjs.org/2013/11/04/Geometry-and-Appearances/

If you have any questions, I’d be happy to help.

-Hannah

We have a task to display radar domes along with jammers. The resulting polygons would be described as free form or irregular3D objects I guess. Basically, we would be given a list of triangles from the output of some application, and then would need to render those triangles.

Questions:

To do this in Cesium:

Would we still need to write a custom Geometry, or has something changed?

Could the triangles be defined in KML and then loaded into Cesium?

I guess we could write the triangles out into a gltf file?

If anyone has any ideas/advice on how we could render these types of objects then it would be great to hear from you!

TIA,

Scott

Hey Scott,

I think defining your own geometry is still the go-to way, that way you have full control over the vertices/geometry. Although just exporting it as a KML/glTF would probably work as well!

If the kml route is an option then what Cesium object renders the triangles?

It looks like KML in Cesium is created with entities (see https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/DataSources/KmlDataSource.js#L348), and entities in Cesium are implemented with primitives under the hood, so it would be Cesium’s engine setting up the geometry/vertices/indices.

Does that answer your question?

You are correct that there isn’t any support in Cesium for the polygons you describe. I see three options:

  1. Implement your own shaders for your custom geometry.
  2. Put your custom geometry into a GLTF model.
  3. Investigate using the STK Web Visualization Library that is sold by AGI (the company that started CesiumJS).
    Scott

Yes that does answer the question.

I’m going the gltf route since that seems like the best fit. I think the KML route would mean each triangle would be an Entity which doesn’t sound like a good way to go. I’ve got most of the code written but I need to figure out the accessors and bufferViews sections, and then I should be done. Thanks for your help!

Scott