Outline geometry questions...

I’ve been trying to use the Geometry system and have run into some issues with outlines. I’m not sure if they are bugs, design decisions or simply things I’m doing wrong.

  1. It looks like OutlineGeometry requires “flat:true” to be passed to PerInstanceColorAppearance and does not work without it (complains about lack of normals, even if I create the geometry with VertexFormat.ALL.) Is this a bug? Why don’t outline geometries just work with the Polyline appearance types since they are always polylines (I get an error about missing nextPosition3DLow).

  2. Can I use MaterialAppearance with OutlineGeometry, or is it limited to just color? I tried but had the same problem as above.

  3. Why can’t I specify an outline width like I can for polylines? It seems odd to have to specify a lineWidth property as part of a renderstate option to the appearance, and it doesn’t work at all under ANGLE.

Like I said, maybe I’m doing something wrong, Here’s the modified Polygon Outline Sandcastle example.

require([‘Cesium’], function(Cesium) {

“use strict”;

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var scene = viewer.scene;

var primitives = scene.getPrimitives();

var ellipsoid = viewer.centralBody.getEllipsoid();

// Green extruded polygon outline

var polygonHierarchy = {

positions : ellipsoid.cartographicArrayToCartesianArray([

Cesium.Cartographic.fromDegrees(-108.0, 30.0),

Cesium.Cartographic.fromDegrees(-98.0, 30.0),

Cesium.Cartographic.fromDegrees(-98.0, 40.0),

Cesium.Cartographic.fromDegrees(-108.0, 40.0)


holes : [{

positions : ellipsoid.cartographicArrayToCartesianArray([

Cesium.Cartographic.fromDegrees(-106.0, 31.0),

Cesium.Cartographic.fromDegrees(-106.0, 39.0),

Cesium.Cartographic.fromDegrees(-100.0, 39.0),

Cesium.Cartographic.fromDegrees(-100.0, 31.0)




var extrudedHeight = 500000.0;

var greenPolygonOutlineInstance = new Cesium.GeometryInstance({

geometry : new Cesium.PolygonOutlineGeometry({

polygonHierarchy : polygonHierarchy,

extrudedHeight : extrudedHeight,

vertexFormat : Cesium.VertexFormat.ALL


attributes : {

color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE)



// Add polygon outline instances to primitives

primitives.add(new Cesium.Primitive({

geometryInstances : [greenPolygonOutlineInstance],

appearance : new Cesium.PerInstanceColorAppearance()




1./2. Yes, the PolylineGeometry will only work with the PerInstanceColorAppearance when it is flat. The normals aren’t generated because they are always facing the viewer. You can think of polylines ass billboards; lighting them doesn’t really make sense. They won’t work with the other polyline appearances because the shaders need extra attributes for the width and to miter the end points. These attributes aren’t generated for the simple polylines.

  1. We wanted to add an option to use polylines with materials as the OutlineGeometry, but it would look awful for extruded geometry. Say you have an extruded polygon with a closed top and bottom. If the outline were only around the top and bottom polygons, everything would be fine. The lines connecting the two cause the problem. The lines around the polygons will have mitered end points and the lines along the extrusion will have squared end points.