I'm using Vulkan to try and render a GLB cube mesh (as a simple example) with a UV texture in my game engine. I've already tried the below to try to map the coordinates to Vulkan space with the SharpGLTF nuget package:
var glb = ModelRoot.Load(glbPath);
var mesh = glb.LogicalMeshes.Single();
var primitive = mesh.Primitives.Single();
var positions = primitive.GetVertexAccessor("POSITION").AsVector3Array().ToArray();
var normals = primitive.GetVertexAccessor("NORMAL").AsVector3Array();
var uvs = primitive.GetVertexAccessor("TEXCOORD_0").AsVector2Array();
var indices = MemoryMarshal.Cast<byte, ushort>(
indexAccessor.SourceBufferView.Content.Slice(indexAccessor.ByteOffset, indexAccessor.ByteLength))
.ToArray();
using var mutator = vertexBuffer.CreateMutator(graphicsDevice, commandList);
for (var i = 0; i < positions.Length; i++)
{
mutator[i] = new Vertex
{
Position = positions[i] with { Y = -positions[i].Y },
Normal = normals[i],
UV = uvs[i] with { Y = 1.0f - uvs[i].Y },
};
}
But it really doesn't seem to be working as expected: 
I'm using the default export settings for Blender, and I've made sure the UV unwrap is correct:
And the UV texture is just a simple outline: 
I'm sure there is something simple I'm missing here, but I just don't have the requisite knowledge to figure out what.
The shaders are very simple:
// .vert
#version 450 core
#extension GL_ARB_separate_shader_objects: enable
#extension GL_ARB_shading_language_420pack: enable
layout (location = 0) in vec3 position;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 texCoord;
layout (binding = 0) uniform UBOProjectionView
{
mat4 proj;
mat4 view;
};
layout (location = 0) out vec3 fragNormal;
layout (location = 1) out vec2 fragTexCoord;
void main()
{
gl_Position = proj * view * vec4(position, 1.0);
fragNormal = normal;
fragTexCoord = texCoord;
}
// .frag
#version 450 core
#extension GL_ARB_separate_shader_objects: enable
#extension GL_ARB_shading_language_420pack: enable
layout (location = 0) in vec3 fragNormal;
layout (location = 1) in vec2 fragTexCoord;
layout (binding = 1) uniform sampler2D texUVs;
layout (location = 0) out vec4 fragColor;
void main()
{
fragColor = texture(texUVs, fragTexCoord);
}
