Hello! I am confused about statement in the NormalMaps page. It says that glTF uses OpenGL as the format for its normal textures. And also there is a picture of UV mapping in gltf:
Shortly, there is image space and there is tangent space.
The Spec is right: glTF images are stored Top-Left (like a standard PNG).
The NormalMaps page is right: glTF normal maps expect the Green channel to point Up (like OpenGL/DX11/Blender), rather than Down (like legacy DirectX).
The source of confusion is letter designations on this pictures.
Both UV and ST usually mean image space coordinate (absolute and normalized one). When I see ST diagram on gltf spec, I assume:
We use top-left memory layout image on disk like PNG (row-major, starting from top)
ST and UV anywhere in the gltf file interpreted accordingly: V and T points into “down” of the image, or forward in memory (if we don’t flip it on load).
If we don’t flip image in memory, we can sample image in shader by providing ST / UV by geometry and it would be still top-left coordinates in image space.
Now look into image from NormalMap page, it says: “how the UVs are stored in a glTF file" and show flipped diagram. Are we still talking about image space? If so, then it is contradiction.
Or do we talking about tangent space already? If so, why we use UV terminology instead of TBN?
Moreover, standard MikkT implementation (which is required by gltf spec) normally align Tangent in the direction of U grows, and Bitangent in the direction of V grows (lets skip flips and orthonormalization for now).
In simple scenario, when I have unit quad XY[0..1] in world space, covered by corresponding tex coordinates ST[0..1], I expected that Tangent points into S/U direction of image (or world X in this case), and Bitangent points into T/V direction of image (or world Y in this case).
I think the docs are misleading. I discussed this with @PatrickRyan who wrote this document originally. The intention of the document regarding the image from the OP is to show that the textures between glTF and Babylon file formats are flipped from each other. I agree this image from the doc implies the UV space of glTF which is not accurate. This document is super old. @PatrickRyan will take a pass at it to make it less misleading.