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

Can a single vertex have multiple UV coordinates depending on how many faces it belongs to? #138

Open
jimver04 opened this issue Apr 17, 2024 · 1 comment

Comments

@jimver04
Copy link

Hi,

Let us assume that we have two triangles connected to make a quad.

I use gltf-sdk to export the quad with 4 UV texture coordinates, one per vertex, as follows.

The upper triangle (T1) has all 3 UV coordinates as pink (3 dots at pink pixel in the example)
image

whereas the lower triangle (T2) has 1 new UV coordinate (1 dot at green) and two old pink UV coordinates from T1
image

So far so good.

In Blender3D, when I select the face of T2, I can change the UV coordinate of the shared upper vertex for T2,
image

the part of T2 at shared vertex become green without affecting T1.
image

When I export from Blender3D to gltf, this shared vertex that has different UV coordinate for T1 vs T2,
becomes duplicated:

image

From what I have understood, GLTF format does not allow a vertex to have two UV coordinates. See this stackoverflow: https://gamedev.stackexchange.com/questions/140132/how-can-i-use-blender-style-uvs-and-not-per-vertex-in-opengl
whereas Blender allows it. Blender uses all features of OpenGL whereas GLTF is let us say a "gpu friendly" format (https://stackoverflow.com/questions/61521259/vertex-normal-texture-uv-coordinate).

  • Does gltf-sdk support vertex duplication when one vertex has two or more UV coordinates depending on how many faces it belongs?
  • Is there any library that can be used within gltf-sdk to do the duplication seamingless ?
  • Is ACCESSOR_TEXCOORD_1 something operational different from ACCESSOR_TEXCOORD_0, does it offer extra capabilities like vertex duplication like in this specific case ?

Best,
Dimitrios

@jimver04 jimver04 changed the title Support of different UV coordinates of faces that share the same vertices ? Can a single vertex have multiple UV coordinates depending on how many faces it belongs to? Apr 17, 2024
@bghgary
Copy link
Contributor

bghgary commented Apr 17, 2024

I'm not sure I understand the ask. glTF-SDK is intended to read/write a glTF, so if the glTF spec doesn't support this, then the SDK won't either. If there is no way to represent what you want in a glTF, then the SDK won't be able to represent it and thus the questions are moot. Or did I misunderstand something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants