Skip to content

glTF support is missing features #528

Closed

Description

@romainguy

Our glTF viewer doesn't work entirely just yet. Here's what I found so far:

  • Tangents/bitangents are not computed correctly if not present in the model
  • We always use the default sampler instead of using the sampler described in the glTF file
  • Vertex colors are ignored
  • Transforms (rotation in particular) are not always handled properly

I found these issues while trying to load various Sketchfab assets.

Activity

  1. added
    bug
    on Nov 26, 2018
  2. romainguy commented on Nov 26, 2018

    @romainguy
    ContributorAuthor

    Rotation issue: https://sketchfab.com/models/a4ca0e3864e143af9bf1dffc7fc8029b (you have to zoom into the black sphere to seen the scene). This model also seems to use vertex colors? Our render is definitely off.

    Non-default samplers: https://sketchfab.com/models/94b24a60dc1b48248de50bf087c0f042 The tramway and some of the walls are not textured properly, most likely because we don't use the right sampler

    None of the textures are loaded for this model: https://sketchfab.com/models/282f497334f64a589edee4e63ad7e428

  3. romainguy commented on Nov 28, 2018

    @romainguy
    ContributorAuthor

    Another bug: the water in https://sketchfab.com/models/e051a32d21d6453c8fad408082492267 is not transparent. The alpha mask is also not working on the bushes in that scene.

  4. prideout commented on Nov 28, 2018

    @prideout
    Contributor

    I'm working on the first bullet in the original problem description (Tangents/bitangents are not computed correctly), which is exemplified by glTF-Sample-Models/2.0/NormalTangentTest.

  5. magicwhale commented on Nov 29, 2018

    @magicwhale
    Contributor

    Rotation issue: https://sketchfab.com/models/a4ca0e3864e143af9bf1dffc7fc8029b (you have to zoom into the black sphere to seen the scene). This model also seems to use vertex colors? Our render is definitely off.

    Non-default samplers: https://sketchfab.com/models/94b24a60dc1b48248de50bf087c0f042 The tramway and some of the walls are not textured properly, most likely because we don't use the right sampler

    None of the textures are loaded for this model: https://sketchfab.com/models/282f497334f64a589edee4e63ad7e428

    The first model seems to just have some rotation issues with the asset itself, and some of the colors aren't showing up because vertex colors aren't implemented yet.
    For the second and third models, the issue seems to just be with the use of multiple UV coordinates.

    Another bug: the water in https://sketchfab.com/models/e051a32d21d6453c8fad408082492267 is not transparent. The alpha mask is also not working on the bushes in that scene.

    I realized that I didn't implement alpha masking and blending for unlit materials, which this scene uses.

    I'm working on fixing the issues now.

  6. magicwhale commented on Dec 4, 2018

    @magicwhale
    Contributor

    It seems like that file and the files mentioned in #503 have some kind of error within the gltf file, and this is causing the viewer to crash within Assimp when it is loading the gltf.

    I saw that Don McCurdy's gltf viewer is still able to show the model even though it says there are errors within the file, so we could find a way to load the files by ignoring the malformed lines.

  7. donmccurdy commented on Dec 4, 2018

    @donmccurdy

    It seems like that file and the files mentioned in #503 have some kind of error within the gltf file, and this is causing the viewer to crash within Assimp when it is loading the gltf.

    If the errors seem unreasonable, I'm glad to send feedback to Sketchfab. Some viewers (like Facebook 3D Posts) enforce a "no validation errors" policy, and if these are issues you'd rather not work around, requiring stricter conformance from exporters is acceptable. The tolerance in my viewer is more accidental than planned. :)

  8. romainguy commented on Dec 4, 2018

    @romainguy
    ContributorAuthor

    Well crashing is never a good option :) But if the crash is inside Assimp our best bet would be to fix it there and upstream the change. We could also investigate TinyGLTF

  9. romainguy commented on Dec 6, 2018

    @romainguy
    ContributorAuthor

    Multi UV sets support is now in. @magicwhale were you able to figure out where the other issues come from?

  10. 3 remaining items

  11. romainguy commented on Feb 20, 2019

    @romainguy
    ContributorAuthor

    Thank you. Texture transforms are just not supported at all at the moment. We're moving to a different gltf loader to fix all these issues.

  12. romainguy commented on Feb 20, 2019

    @romainguy
    ContributorAuthor

    I'm surprised by the tangents though, @prideout wasn't this fixed?

  13. prideout commented on Feb 20, 2019

    @prideout
    Contributor

    Just now reproduced the issue with Normal Tangent Mirror, I'm surprised too. Will investigate.

  14. prideout commented on Feb 20, 2019

    @prideout
    Contributor

    tl;dr:

    For now I think I should simply modify our copy of MeshAssimp to negate the bitangent, thus moving our current workaround downward so that it doesn't affect the tangents-are-available case. This will be fixed in a more proper way in the new glTF loader that I'm working on.

    details:

    We render NormalTangentTest correctly (where tangents are computed via MeshAssimp) but we do not render NormalTangentMirrorTest correctly (where tangents are supplied in the model).

    When MeshAssimp generates tangents and bitangents, it basically makes tangents follow texcoord U, and bitangents follow texcoord V. The resulting tangent vectors are fairly consistent with a couple popular viewers that I tried, but the bitangent vectors are not. Other viewers use different approaches:

    • ThreeJS (and therefore Don McCurdy's viewer) does this
    • The Khronos ref viewer does this
    • The spec recommends mikktspace (which Blender uses I think) which does this
  15. donmccurdy commented on Feb 20, 2019

    @donmccurdy

    ThreeJS (and therefore Don McCurdy's viewer) does this

    Note that this change is very recent, and won't be visible in my viewer until threejs r102 is released. But I think BabylonJS (and this viewer) do the same.

  16. romainguy commented on Apr 24, 2019

    @romainguy
    ContributorAuthor

    Closing this for now. There are still a couple of unsupported features like blend shapes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions