Closed widefire closed 1 month ago
Can you provide a model that reproduces this problem?
this is a gltf file display error in GLTF Viewer basic_sample_new_material.zip trees and car colored red,as below but they are no materials,in three.js like this:
The GLTF material not matched with some files.while the gltf file materials not empty,but some primitive material_id == -1,these primitives used the last of materials. I found in founction void Model::LoadMaterials(const tinygltf::Model& gltf_model, const ModelCreateInfo::MaterialLoadCallbackType& MaterialLoadCallback) create default material only when the gltf file no materials:
in function https://github.com/DiligentGraphics/DiligentTools/blob/fe2bc14c747314a6924fc59c6782a4697b5c6473/AssetLoader/interface/GLTFBuilder.hpp#L356 NewMesh.Primitives.emplace_back( IndexStart, IndexCount, VertexCount, GltfPrimitive.GetMaterialId() >= 0 ? static_cast(GltfPrimitive.GetMaterialId()) : static_cast(m_Model.Materials.size() - 1),
PosMin,
PosMax //
);
just use the last material while Primitive mateiral_id < 0, so these primitives display error