# How to set outline color of polygon geometry when using Cesium.MaterialAppearance

**URL:** <https://community.cesium.com/t/how-to-set-outline-color-of-polygon-geometry-when-using-cesium-materialappearance/2957>\
**Category:** CesiumJS\
**Created:** [August 21, 2015, 7:37pm UTC](https://community.cesium.com/t/how-to-set-outline-color-of-polygon-geometry-when-using-cesium-materialappearance/2957 "2015-08-21T19:37:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alberto\_Acevedo](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alberto\_Acevedo](https://community.cesium.com/u/Alberto_Acevedo)\
**Post date:** [August 21, 2015, 7:37pm UTC](https://community.cesium.com/t/how-to-set-outline-color-of-polygon-geometry-when-using-cesium-materialappearance/2957/1 "2015-08-21T19:37:46Z")

</div>

I need your guidance. I’m rendering 3d polygon primitives but I’m not able to find a way to see the delineation of corners or joints of the walls of the polygon. Is there a way to set an outline color for the polygon? I tried to see the delineation of the walls by setting translucent to true but the rendered shape doesn’t look translucent.

I’m using Cesium.MaterialAppearance instead of the PerInstanceColorAppearance because MaterialAppearance allows me to  
easily change the color of the shape (material.uniforms.color) after it is already created.

My code is below:

var geometryInstance = new Cesium.GeometryInstance({  
geometry: Cesium.PolygonGeometry.fromPoints({  
positions: positions,  
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX\_FORMAT,  
perPositionHeight: true})  
attributes: { color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.Yellow)}  
});

var material = new Cesium.Material.fromType(“Color”);  
material.uniforms.color = Cesium.Color.Yellow;

var appearance = new Cesium.MaterialAppearance({  
material: material,  
translucent: true,  
closed: true,  
renderState: { lineWidth: Math.min(2.0, this.scene.maximumAliasedLineWidth), lineColor: Cesium.Color.Black},  
faceForward: true});

var primitive = new Cesium.Primitive({  
geometryInstances: geometryInstance,  
allowPicking: pickable,  
interleave: true,  
appearance: appearance,  
releaseGeometryInstances: false});

Thanks,

Alberto

---

<div class="post-metadata">

**Author:** ![Alberto\_Acevedo](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alberto\_Acevedo](https://community.cesium.com/u/Alberto_Acevedo)\
**Post date:** [August 21, 2015, 7:51pm UTC](https://community.cesium.com/t/how-to-set-outline-color-of-polygon-geometry-when-using-cesium-materialappearance/2957/2 "2015-08-21T19:51:07Z")

</div>

See attached snapshot for a better description of my issue.

![polygon_no_outline.png](https://global.discourse-cdn.com/cesium/original/3X/4/6/4648856ac841e6310c51023ea85623615d378476.png)

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [August 22, 2015, 1:41am UTC](https://community.cesium.com/t/how-to-set-outline-color-of-polygon-geometry-when-using-cesium-materialappearance/2957/3 "2015-08-22T01:41:26Z")

</div>

When using the Primitive API, you need to create a separate geometry with separate batching in order to handle outlines. In polygon’s case that’s PolygonOutlineGeometry. Using Primitives is much more verbose and requires more code because it more accurately reflects what’s going on in the engine. Unless you have a specific reason not to, I recommend you use the Entity API instead, which you can read about in the [Visualizing Spatial Data tutorial](http://cesiumjs.org/2015/02/02/Visualizing-Spatial-Data/)

---

<div class="post-metadata">

**Author:** ![Alberto\_Acevedo](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alberto\_Acevedo](https://community.cesium.com/u/Alberto_Acevedo)\
**Post date:** [September 1, 2015, 7:55pm UTC](https://community.cesium.com/t/how-to-set-outline-color-of-polygon-geometry-when-using-cesium-materialappearance/2957/4 "2015-09-01T19:55:30Z")

</div>

Matthew,

I was able to improve the outline by adding the wall Geometry to the primitive.  
I will follow your advice and start migrating the primitives into entities.

Thanks,

Alberto
