New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
computeVertexNormals doen't work correctly with mesh loaded using OBJ Loader #8378
Comments
BTW, even if vertices are shared, if you call @mrdoob Should Related: #7201 |
Thanks for the answer I guessed it was something like that.... (BufferGeometry which does not share vertices), but it looks like a problem to me: In the OBJ format, vertices are described as shared (indexed), so the loaded mesh doesn’t fit the geometry described in the OBJ file somehow. Using non-indexed BufferGeometry doesn’t allow using computeVertexNormals + smooth shading on loaded geometries ... a bit inconvenient. Besides having different behaviors on mesh depending on the file format (VRML/OBJ) is a bit weird. I don’t have a good grasp about what using indexed or non-indexed BufferGeometry involves deep indside three js/WebGL. It should make sense for some reason ... but in worse case, couldn't we have it as an option for loaders? Thanks to point me out the "crease angle" problem ... should be great to have this in computeVertexNormals method as a parameter ;) but it's not the point. Thanks a lot |
The reason it doesn't return indexed is because the obj format doesn't map well to indexed. In obj, vertices, normals and colors don't share the same index. |
Ah, yes. |
Thanks for the answer, I see what you mean about different indexes ... Example of a face in my OBJ: f 6/9/13 5/7/13 14/1/13 with vertex-index/texture-uv-index/normal-index for every vertex of the described face...for example for texture in indexed BufferGeometry, you must have one uv indexed value corresponding to one indexed vertex and that not necessary the case in OBJ format, i'm i right ? a few questions :
For UV maps, it looks like a defect to me : I don't understand why all faces sharing a vertex should refer to the same point in uv map. |
It's a limitation of WebGL. |
Ok, So it makes sense to me now ... but :) ... destroying vertices index information when loading OBJ seems to still a problem. In fact, back to the issue, that means you could never have a smooth shading on OBJ using computeVertexNormals nor any computed method : If normals are not correctly set in the OBJ file, its over right ? vertices Index information shouldn't be kept somewhere ? |
As I said,
|
yeah in a perfect world, it would :) |
You could compute the normals in Blender and re-export. |
Ok i'll do that, thanks |
Description of the problem
I'm using computeVertexNormals on mesh from OBJ and VRML Loader in order to have a smooth shading applied.
It works with VRML Loader but it don't using OBJ Loader with exactly the same mesh.
You can see how normal looks like in the 2 cases :
VRML is smooth shaded and normals (even if inside the mesh) are mingled for one given vertex.
OBJ mesh normals are diverging for one given vertex and consequently mesh is not smooth shaded.
The question is ... why ?
One difference I have noticed is loaded mesh use geometry in VRML case and BufferGeometry in OBJ case.
Thanks in advance for answers
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: