Closed junglie85 closed 1 year ago
can you, please, share your model and textures?
so, looking at your file it does not seem that your textures are embedded to the file but they are separated files. loading the file I can see in materials:
MaterialProperty {
key: "$tex.file",
data: String(
"normal.png",
),
index: 0,
semantic: Height,
},
MaterialProperty {
key: "$tex.file",
data: String(
"specular.jpg",
),
index: 0,
semantic: Specular,
},
MaterialProperty {
key: "$tex.file",
data: String(
"diffuse.jpg",
),
index: 0,
semantic: Diffuse,
},
so you can load those files as your textures.
I posted the full debug output of the scene.materials
so I’m a bit confused where you’re getting the MaterialProperties
that contain the texture details. Could you elaborate?
Also, in the original example it looks like the properties come from what would be the textures
field:
vector<Texture> loadMaterialTextures(aiMaterial *mat, aiTextureType type, string typeName)
{
vector<Texture> textures;
for(unsigned int i = 0; i < mat->GetTextureCount(type); i++)
{
aiString str;
mat->GetTexture(type, i, &str);
Texture texture;
texture.id = TextureFromFile(str.C_Str(), directory);
texture.type = typeName;
texture.path = str;
textures.push_back(texture);
}
return textures;
}
Should that not also be the case with russimp or have I misunderstood what’s happening here?
hey mate, this is the implementation I made to get the results I mentioned you. https://filebin.net/mdws6uro5d1mpn66 I believe you can use 7zip to extract it on windows.
russimp does not provide the same interface as the c++ implementation. if the texture is embedded to the model then russimp will provide you with its contents, otherwise you can read the file pointed by MaterialProperty.
hi, i was also puzzled by this while going through the learnopengl tutorial on Rust. i know nothing about Assimp or model loading, but would it make sense to initialize a Texture with empty DataContent
if it's not an embedded texture? perhaps even add an is_embedded
field to Texture struct, so at least users know that the texture is detected but data isn't loaded.
Hey. I'm working on a port of the learnopengl tutorial samples to wgpu and am a bit stuck on the model loading section. My implementation is failing because no textures are being found.
.mtl
file:Scene materials:
I'm loading the scene like so: