GLTF_Viewer is not able to load textures
PalashGarg19 opened this issue · 1 comments
I am trying to open a gltf model having thousands of meshes and 50-60 textures in it. The GLTF_Model_Viewer.html is able to render all the meshes but the textures applied to them is not visible. Is there something I am missing?
The gltf that i am importing is correct as I am able to see the textures in other GLTF viewer.
@PalashGarg19
Hello,
No there is nothing you are missing - unfortunately, there are many things missing on my project's end. I have stated elsewhere in the issues board here that although I am very comfortable and experienced with the ray tracing side of things (the nuts and bolts of the renderer and light transport, etc.) my weakest area is loading and correctly displaying glTF models with arbitrary numbers of models and textures. In the past I was able to get a single glTF model (like the well-known Damaged Helmet model used in three.js examples) path traced correctly, but that is only because it had one mesh and one over-arching texture for all the PBR textures (1 for albedo color map, 1 for normal map, 1 for roughness map, 1 for emissive map, etc).
When I tried to ramp up the scale - more component meshes inside the same model file, or more multi-materials requiring many textures, I could not get it working, like you see in the awesome GLTF viewer by Don McCurdy that you linked to above. My BVH builder is not equipped to handle multiple meshes - instead, it currently is forced to combine all of the vertices from all the different component meshes into 1 monolithic mesh, which screws up the multi-materials and different textures that the original model came with. So that is why you were seeing the meshes correctly, but not the materials in the glTF Model Viewer on this project.
Also, of all the dozens of demos on my project, the only one I didn't write is the GLTF_Model_Viewer (ha), which was contributed by another author. I'm kind of surprised that you even got the multiple meshes working, but I'm not surprised unfortunately that none of the textures are rendering correctly. A lot more planning and study on my end would be required to be able to first, handle multiple 100s or 1000s of meshes with a TLAS (Top-Level Acc. Structure) and BLAS (Bottom-Level Acc. Structure), the way NVIDIA does it with RTX. Then after that, a similar amount of effort will be required to assign the correct material properties and texture data to every single triangle of every single mesh, once it is placed in those 2 Acc. structures.
That being said, I can recommend Garrett Johnson's three-gpu-pathtracer, as I know that he has implemented the hefty infrastructure to handle loading and rendering scenes with many meshes and materials, all sitting on top of the three.js library, like my project does.
Hope this helps and hope I clarified some of the issues and features that are still missing from my project. Let me know if you have any other questions, and I will answer to the best of my ability. Best of luck!
-Erich