I've managed to successfully display a .obj file using three.js by adapting code I found online for my project. However, I'm now facing challenges when trying to incorporate the .mtl material file.
Despite attempting various solutions, nothing seems to be working. As a beginner in three.js, I believe there's something crucial that I'm missing...
Below is the current functional code responsible for displaying my .obj file:
// JavaScript code snippet here...
Here's a snippet where I attempted to load the .mtl file, albeit unsuccessfully:
// More JavaScript code here...
After some research, it appears that having a mesh is essential for materials to function correctly. Yet, I'm struggling to grasp how to implement this based on available documentation.
Any guidance on incorporating an mtl file into my code would be immensely valuable!
** EDIT **
Following advice from Mugen87, I revised the code snippet as shown below:
// Updated JavaScript code snippet here...
I also included MTLLoader.js from the Three.js examples (unsure if this is correct), and encountered the following errors in the console:
// Error messages displayed here...
Any suggestions? Could the issue lie with how I integrated the MTL into the code?