0

In Three.js I'm using OBJMTLLoader.js to load my 3D model.

After Chrome has loaded the scene, the model is not shown. In the console I have >60'000 warnings. They all look like:

THREE.OBJMTLLoader: Unhandled line f -215//-215 -202//-202 -212//-212

When I use OBJLoader.js to load the model (without the .mtl file), the model gets loaded successfully (of course without materials)

What is the problem with the OBJMTLLoader.js loader?

This is how I load the model:

<script src="scripts/objmtlloader.js"></script>
<script src="scripts/DDSLoader.js"></script>
<script src="scripts/MTLLoader.js"></script>

...

THREE.Loader.Handlers.add(/\.dds$/i, new THREE.DDSLoader());
var loader = new THREE.OBJMTLLoader();    
loader.load(objFileName, mtlFileName, function(object) {
    scene.add(object);
});
ossmoos
  • 1
  • 2
  • Are you sure your model can be loaded in other .obj loaders. Those numbers are indexes to faces, so they should not be negative. – gaitat Dec 20 '14 at 19:38
  • Yes I'm sure, the model gets loaded - even looks quite pretty! Do you mean changing to positive numbers would fix the problem? – ossmoos Dec 20 '14 at 19:42
  • Negative indices in OBJ are indices relative to the last vertex added (at that point in the file). They are a pain, and unsupported by many OBJ readers. – Paul-Jan Dec 20 '14 at 21:13
  • Btw. I checked the code of OBJLoader, in that loader negative indices are handled: var face_pattern4 = /f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/ – ossmoos Dec 21 '14 at 08:48

0 Answers0