I've been encountering issues with OBJ files that I've downloaded from the internet.
All of these files render like this:
View Obj File Pic
I'm using the standard OBJLoader for rendering.
var loader = new THREE.OBJLoader();
loader.load( objURL, function ( object ) {
scene.add( object );
} );
I'm struggling to pinpoint what might be causing the problem.
UPDATE: Here is my full loader code:
loader = new THREE.OBJLoader(manager);
loader.load(filePath, function (object) {
object.traverse(function (child) {
if (child instanceof THREE.Mesh) {
if (count == 1) {
child.material = material;
var box = new THREE.Box3().setFromObject(child);
xyzSizes = box.size();
var geometry = new THREE.Geometry();
geometry = child.geometry;
var volume = myVolume(geometry);
THREE.GeometryUtils.center(geometry);
scene.add(child);
DOM.children(".loading").remove();
myObj = child;
myObj.name = 'GL' + idfile;
maxSize = Math.max(xyzSizes.x, xyzSizes.y, xyzSizes.z);
maxSize = 2 / maxSize;
DOM.parent().find('.volumeVal').html(myRound(volume, 2));
DOM.parent().find('.sizesVal').html('x: ' + myRound(xyzSizes.x, 3) + ' y: ' + myRound(xyzSizes.y, 3) + ' z: ' + myRound(xyzSizes.z, 3));
console.log('il volume è: ' + volume + ' e gli assi xyz sono: ' + xyzSizes.x, xyzSizes.y, xyzSizes.z);
if (maxSize == 0)
maxSize = 0.1;
object.scale.set(maxSize, maxSize, maxSize);
} else {
child.material = transparent;
}
} else {
}
count++;
});
});