Is there any special way to render a gltf model?

Is there any special way to render a gltf model?

For some reason the color looks off and the iron looks way more reflective than normal.
It works fine when I loaded the model with assimp and rendered with the same shaders.
I tried putting the assimp loaded material on the GLTF Iron Sphere and got the got the same result.
Tried comparing vertices between the assimp and gltf , and for some reason the gltf version had a lot less vertices for the same model in a different format. I tried tried loading the gltf file through assimp, and the material actually looked iron…

GLTF doesn’t seem to load bitangent automatically like Assimp does I’ve been finding the bitangent by:

        GLTFVertex vertex;
        vertex.Position = glm::vec4(glm::make_vec3(&PositionBuffer[x * 3]), 1.0f);
    vertex.Normal = glm::normalize(glm::vec3(NormalsBuffer ? glm::make_vec3(&NormalsBuffer[x * 3]) : glm::vec3(0.0f)));
    vertex.UV = UVBuffer ? glm::make_vec2(&UVBuffer[x * 2]) : glm::vec3(0.0f);
    vertex.Color = ColorBuffer ? glm::make_vec4(&ColorBuffer[x * 4]) : glm::vec4(0.7f, 0.7f, 0.7f, 1.0f);
    vertex.Tangant = TangantBuffer ? glm::make_vec4(&TangantBuffer[x * 4]) : glm::vec4(0.0f);
    vertex.BiTangant = cross(vertex.Normal, glm::vec3(vertex.Tangant.x, vertex.Tangant.y, vertex.Tangant.z)) * vertex.Tangant.w;

Materials are loaded in these formats:
MetallicRoughness: VK_FORMAT_R8G8B8A8_UNORM
AmbientOcclusion: VK_FORMAT_R8G8B8A8_UNORM

In the shader:
Metal is set to the Blue Channel.
Roughness is set to the Green Channel.

Or could it have more to do with how blender exports gltf models?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.