cesium-native icon indicating copy to clipboard operation
cesium-native copied to clipboard

upsampleGltfForRasterOverlays produces unnormalized normals

Open kring opened this issue 1 year ago • 3 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.

kring avatar Apr 05 '24 05:04 kring

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

kring avatar Apr 05 '24 05:04 kring

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)

csciguy8 avatar Apr 09 '24 17:04 csciguy8

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.

kring avatar Apr 09 '24 19:04 kring