three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Problem on load .obj file

Open buffaly opened this issue 13 years ago • 35 comments

I found some problem on loader .obj

qthreejs

image

Some face on model missing. What's the problem?

buffaly avatar Jul 22 '13 19:07 buffaly

Looks like your obj file is corrupted. Have you tried re-importing the model in another app? Could also be that the missing faces actually have flipped normals and the default material is single sided. On Jul 22, 2013 12:30 PM, "ohm2kohm2k" [email protected] wrote:

I found some problem on loader .obj

[image: qthreejs]https://f.cloud.github.com/assets/4066162/837352/88709c66-f304-11e2-9fb3-6cbbb61ec999.jpg

[image: image]https://f.cloud.github.com/assets/4066162/837379/0bcb231a-f305-11e2-8621-c767ab18be09.png

Some face on model missing. What's the problem?

— Reply to this email directly or view it on GitHubhttps://github.com/mrdoob/three.js/issues/3662 .

arodic avatar Jul 22 '13 19:07 arodic

I try this model with SKETCHFAB on OSG.JS

http://sketchfab.com/show/si73x3CbE4DloGsXB8NTfo1PWCm

don't found this problem. I'm sure my model is normals and material is without. I'm trying to fix it up but I can't.

sorry about my written language. I'm come from Thailand. T^T

buffaly avatar Jul 22 '13 19:07 buffaly

Could you share the .obj?

mrdoob avatar Jul 22 '13 20:07 mrdoob

OK. I will share it. wait a minute.

buffaly avatar Jul 22 '13 20:07 buffaly

https://www.dropbox.com/sh/nn66j49yhd67nsk/Ao_HJisA5X

buffaly avatar Jul 22 '13 20:07 buffaly

Found some thing wrong? To Day I create new model with MAYA to .obj. I use ThreeJS to loader it up. It was the same problem.

buffaly avatar Jul 23 '13 09:07 buffaly

It's a big file. I couldn't get to load it yet.

mrdoob avatar Jul 23 '13 09:07 mrdoob

wait a minuts. I have another model to be like that.

buffaly avatar Jul 23 '13 09:07 buffaly

image

buffaly avatar Jul 23 '13 09:07 buffaly

https://www.dropbox.com/sh/3kylkr1h91mbddr/FfBYxoufbm

buffaly avatar Jul 23 '13 09:07 buffaly

image

buffaly avatar Jul 23 '13 09:07 buffaly

image Normal face on Maya

buffaly avatar Jul 23 '13 09:07 buffaly

Ah. I see the problem. Yes, usually you get normals flipped when mirroring objects. Can you try this? http://www.3dbuzz.com/forum/threads/179040-Automatically-fix-face-normals?s=48d99bc7b0eb77a8c0ce6b4807c7e07f&p=1469801#post1469801

mrdoob avatar Jul 23 '13 10:07 mrdoob

image I try it now but not thing happen.

buffaly avatar Jul 23 '13 10:07 buffaly

I think i can confirm that the skull.obj works fine with 3dsMax 2013. Except for not finding the mtl-file, the object looked great. i checked with xView against wrong face orientation and also checked with backface-culling aktivated. There are some messed up faces in the original object around the mouth region but it was looking good overall, not like the screenshot where the skull object is messed up on one side of the mesh. Anyway, just saying that i couldn't find anything wrong with 3dsMax... not sure if this helps :D

GuyGood avatar Jul 23 '13 11:07 GuyGood

OK, I can make it. image

Display face normals. look at the left wing and right wing. wrong face normals but can display ture on ThreeJS. I don't understan what happen? image

may be ThreeJS loaderOBJ don't know much more about Instance or duplicate object.

buffaly avatar Jul 23 '13 12:07 buffaly

Yes. I think the normals are wrong. Look at the left top wing, the normals are from the faces on the other side.

The reason Maya is displaying it "correctly" is because they rendering the object doubleSided. Is the same thing as if you would do:

object.traverse( function ( child ) {

    if ( child.material !== undefined ) material.side = THREE.Doubleside;

} );

mrdoob avatar Jul 23 '13 13:07 mrdoob

Thank You so much. image

See through but face missing. T^T so scary. I will find new way out. Can I covert .obj to .js on web? How SKETCHFAB use to covert .obj to .js?

buffaly avatar Jul 23 '13 14:07 buffaly

The normals may be incorrect due to mirroring, but that is not the real problem. The real problem, I expect, is the winding order on some faces is clockwise, not counter-clockwise. Mirroring a geometry can cause the winding order to flip.

You can see this in the first image in this post. The background color is showing through. If the normal was the only problem, then the face would render, but the shading would be black (or ambient).

WestLangley avatar Jul 23 '13 15:07 WestLangley

I remember in 3DSMax there was the option "Reset XForm" that fixed geometries that had been mirrored.

mrdoob avatar Jul 23 '13 15:07 mrdoob