# normal generation quantized mesh

**URL:** <https://community.cesium.com/t/normal-generation-quantized-mesh/9138>\
**Category:** CesiumJS\
**Created:** [March 13, 2020, 11:47am UTC](https://community.cesium.com/t/normal-generation-quantized-mesh/9138 "2020-03-13T11:47:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous1](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@anonymous1](https://community.cesium.com/u/anonymous1)\
**Post date:** [March 13, 2020, 11:47am UTC](https://community.cesium.com/t/normal-generation-quantized-mesh/9138/1 "2020-03-13T11:47:53Z")

</div>

I am trying to add normals for a quantized mesh terrain server but I cannot find exact instructions on how these normals are supposed to be calculated.

First I tried to simply calculate them using the neighbouring faces:

![vertex_normal.png](https://global.discourse-cdn.com/cesium/original/3X/c/b/cbed0e0ceee6a0d6dea7f0ccb3722301cb300078.png)

It seemed to be be correct but the shadows in Cesium were strange.

So I compared some tiles and figured that I probably have to include the tiles position in EECF into the normal calculation as the 0/0/0-tile from Cesiums Terrain Server looks like:

![zerotile_cesium.png](https://global.discourse-cdn.com/cesium/original/1X/fe906eef7901d0237faa6cf86e1d93160789152e.png)

I then ended up calculating a vector from the earth center to each vertex in my mesh.

Using only this as normal looks quite similar for my 0/0/0-tile but this way no local vertex normal information is being included:

![zero-tile_mine.png](https://global.discourse-cdn.com/cesium/original/3X/9/a/9a9bac11d7e9835bbae4467a5a6bab170c8b8aff.png)

I thought I would have to add both the EECF vector and the normal vector up but this again leads to shadows which do not seem to be accurate:

![combined.png](https://global.discourse-cdn.com/cesium/original/3X/8/a/8a4c2100a8271ffbcfe314336553c05e2b12ce6e.png)

Any thoughts on combining these or am I completely mistaken in the calculation procedure?

Thanks a lot.
