CesiumGS / cesium-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

upsampleGltfForRasterOverlays produces unnormalized normals

kring opened this issue · comments

glTFs created by the upsampleGltfForRasterOverlays often fail validation with messages like this:

{
  "code": "ACCESSOR_VECTOR3_NON_UNIT",
  "message": "Vector3 at accessor indices 810..812 is not of unit length: 0.9929924240874767.",
  "severity": 0,
  "pointer": "/meshes/0/primitives/0/attributes/NORMAL"
}

This is almost certainly caused by the linear interpolation of vertex attributes in order to trim triangles that cross the tile edge. We should re-normalize the normals after interpolating. This is slightly tricky only because we don't currently know which attributes are normals, and hence should be renormalized. Note that TANGENT also has normalization requirements.

IMO this isn't a serious problem and glTF-Validator is just being a little alarmist here, but it would be good to fix.

glTFs created by the upsampleGltfForRasterOverlays

Do you happen to know of an easy way to generate a glTF in this way?

(thinking ahead for whoever works on this)

Just zoom in close to CWT+Bing in any of our engine integrations. There are tests for it, too. If you want to write it out as a GLB on disk, though, the easiest way there is to use the other project I've been working on lately.