I found some problem on loader .obj


Some face on model missing.
What's the problem?
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
.
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
Could you share the .obj?
OK. I will share it.
wait a minute.
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.
It's a big file. I couldn't get to load it yet.
wait a minuts. I have another model to be like that.



Normal face on Maya
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

I try it now but not thing happen.
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
OK, I can make it.

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?

may be ThreeJS loaderOBJ don't know much more about Instance or duplicate object.
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;
} );
Thank You so much.

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?
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).
I remember in 3DSMax there was the option "Reset XForm" that fixed geometries that had been mirrored.
Files on SculptGL :


Don't know if it can help but my loader ignore the normals in the obj files...
I just recompute them... so the ship indeed has reverse winding stuffs for the two mirrored wings.
The skull is fine... maybe you should recompute all the normals
I also ignore all the materials/texCoord stuffs.
The skull is fine... maybe you should recompute all the normals
Hmmm. I'm surprised... By my argument above, the bad faces had incorrect winding order...
Cool!!! Can I try it with SculptGL?
Hmmm. I'm surprised... By my argument above, the bad faces had incorrect winding order...
I recompute the normals solely according to the winding... so the winding in the skull is fine.
Here's my code for the obj loader
https://github.com/stephomi/sculptgl/blob/master/misc/files.js
Hmmm it seems you don't take into account the negative indices for faces??
https://en.wikipedia.org/wiki/Wavefront_.obj_file (see Relative and absolute indices)
I don't know if it's the problem for the skull though...
EDIT : hmm after greping... it seems there're no negative indices in the skull file
Thank you
I'm having the same problem with the three.js OBJLoader with my exported obj file from maya. I've checked the normals, tried turning off double sided, and there are no holes in maya. Turning on double sided in THREE.js does nothing either. I am pretty certain that my model is ok, since it was printable as an stl file

in firefox with objloader

are there any other formats that maya can export without having to download anything, that three.js can read?
I see this with some models I use, and when investigated the issue has been winding order.
This is the only thing i could find regarding winding order in Maya. http://download.autodesk.com/us/maya/2010help/index.html?url=Editing_UVs_Display_UV_winding_order.htm,topicNumber=d0e255897
Should I try flipping the uv's? Not sure if that's the same thing in Maya.
I made a cube like object that i negative scaled/combined, tried flipping the uv's still unable to reproduce the holes though on a simple model.
Ok... I was able to figure out the problem by deleting away the faces until there was just 1 face that was rendering improperly, then I looked at it in the obj file. Maya's obj exporter allows faces with more than 4 sides, which the OBJLoader does not read. All you have to do is triangulate your mesh before you export to obj, and it should load fine in three js. Hope this helps anyone.

Maya's obj exporter allows faces with more than 4 sides
If you have a sample file with such faces I can try to implement in OBJLoader.
@StephenHopkins Thank you, your answer just great, fix the issue!! Thanks again!
Sorry to get back to this old issue :)
I have the same problem with obj files exported from freecad using the https://github.com/microelly2/freecad-export/
In the repo you will also find a sample obj file!

ps. I used the /examples/webgl_loader_obj_mtl.html
@trillerpfeife Please don't ask for help at gihub. Use stackoverflow or the forum instead.
@mrdoob Sorry, I thought it was still an 'issue'.
BTW solution:
mtlLoader.setMaterialOptions({side: THREE.DoubleSide})
Most helpful comment
@mrdoob Sorry, I thought it was still an 'issue'.
BTW solution:
mtlLoader.setMaterialOptions({side: THREE.DoubleSide})