Hi,
I’m trying to render GLTF models using VTK, and I followed this example.
I first tried with the flight helmet model downloaded from sketchfab, and everything worked fine.
Then I downloaded another model and read it using the same example code(only changed file name). The model was rendered, but not the textures.
Below is the screenshot. Left is the model opened in CAD Assistant. Right is the model rendered using example code.
What caused the texture not being loaded?
The model files are below(I tried to zip them into a single zip file, but that would exceed the attachment size limit). Originally downloaded from sketchfab. scene.bin (3.3 MB) scene.gltf (3.7 KB) textures.zip (3.2 MB)
the textures.zip should be unzipped and the structure of the files are
|scene.bin
|scene.gltf
|textures
|*.jpeg
Hi thank you for the verification. I can open the model with cad assist, and I checked the .gltf file, the texture directory seems to be correct.
I can think of two ways to solve this problem.
1.I tried loading the models only with vtkGLTFReader, maybe I can then apply textures to this model to achieve the same result.
2.verify if the models are downloaded correctly using another library. I’ll try F3D and see if it loads textures.
hi sorry for late reply.
I checked F3D and as you said it has the same behavior as VTK.
I tried the first method and it loads the texture but not the way I want the textures to be loaded. I think it’s because the texture coords need to be consistent with what’s specified in .gltf file.
I think the workaround is to get the model using other formats(.obj for example). Or I need to dive into how .gltf is handled behind the scene and see if there’s a fix.
Thanks for your time and help anyway.