Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upsampleGltfForRasterOverlays produces unnormalized normals #845

Open
kring opened this issue Apr 5, 2024 · 3 comments
Open

upsampleGltfForRasterOverlays produces unnormalized normals #845

kring opened this issue Apr 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@kring
Copy link
Member

kring commented Apr 5, 2024

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 kring added the bug Something isn't working label Apr 5, 2024
@kring
Copy link
Member Author

kring commented Apr 5, 2024

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

@csciguy8
Copy link
Contributor

csciguy8 commented Apr 9, 2024

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)

@kring
Copy link
Member Author

kring commented Apr 9, 2024

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.

@j9liu j9liu added good first issue Good for newcomers and removed good first issue Good for newcomers labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants