How to add surface's normal to a cylinderGeometry with "slices = 6"

Hello !

I tried to create a cylinder with hexagon bottom projection as follows:

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

var cylinderGeometry = new Cesium.CylinderGeometry({
length : 5000,
topRadius : 3000,
bottomRadius : 3000,
slices: 6,
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT

var cylinder = new Cesium.GeometryInstance({
geometry: cylinderGeometry,
modelMatrix: Cesium.Matrix4.multiplyByTranslation(
Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(116.60777 , 40.04883),
new Cesium.Cartesian3(0.0,0.0, length/2),
new Cesium.Matrix4()
attributes: {
color : Cesium.ColorGeometryInstanceAttribute.fromColor( Cesium.Color.fromCssColorString(’#0070c0’))

var primitive = new Cesium.Primitive({
geometryInstances : cylinder,
appearance: new Cesium.PerInstanceColorAppearance({
closed : true,
translucent: false,
flat: false,
faceForward: false



It is hard to distinguish the bottom projection is a circle or a hexagon,

how can I add normal to a cylinderGeometry?


Currently the surface normals are pointing out from the edges of the sides of the cylinder, which is why they are being blended together. You would need to duplicate the points at each corner so you can have a normal for one side and a normal pointing in a different direction for the other.

You would need to edit the code here:

However, if you only want a hexagon it might be easier to write a new custom geometry type that meets your needs.

For some more information about this, you can see this (slightly outdated and never published) post I wrote about creating custom geometry:

And you can see our build guide for instructions on downloading and building the code base:



Thanks Hannah, so nice of you

在 2017年2月6日星期一 UTC+8下午10:49:34,Hannah Pinkos写道: