Skip to content
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

Ray.intersectObject doesn't seem to work on non-planar quads #1357

Closed
kig opened this issue Feb 19, 2012 · 9 comments
Closed

Ray.intersectObject doesn't seem to work on non-planar quads #1357

kig opened this issue Feb 19, 2012 · 9 comments

Comments

@kig
Copy link

kig commented Feb 19, 2012

The intersectObject code should split non-planar Face4s into two Face3s.

https://github.com/mrdoob/three.js/blob/master/src/core/Ray.js

@WestLangley
Copy link
Collaborator

This is a known issue. See #1256 for the cause and a work-around.

@kig
Copy link
Author

kig commented Feb 19, 2012

Thank you very much, that's perfect!

@mrdoob
Copy link
Owner

mrdoob commented Feb 20, 2012

As far as I understand it, the problem is basically about normals. Right now we use the normal of the face for the first part of the Ray checks. But a Face4 should have 2 normals in order for this to work without having to recompute the normal for every check.

I can't think of a nice way to solve this. Maybe the triangulation is a good solution for this?

@bhouston
Copy link
Contributor

bhouston commented Feb 4, 2013

This should be closed as "won't fix." Quads in a mesh are invalid if they are not planar. If they are not planar, it should be two separate triangles otherwise it is considered an invalid mesh.

@mrdoob
Copy link
Owner

mrdoob commented Feb 5, 2013

Oh. That's interesting.

@WestLangley
Copy link
Collaborator

Quads in a mesh are invalid if they are not planar. If they are not planar, ... it is considered an invalid mesh.

If this statement is true, then due to round-off error, almost all quads are non-planar, and hence almost all meshes containing quads are invalid.

Do we want to make it our policy that a mesh having a quad that is non-planar (outside of round-off error) is "invalid"?

@bhouston
Copy link
Contributor

bhouston commented Mar 7, 2013

@WestLangley asked "Do we want to make it our policy that a mesh having a quad that is non-planar (outside of round-off error) is "invalid"?

I think that is generally the case isn't it? Quads have ambiguous triangulations and if a Quad is non-planar than the result can be dramatically different depending on the triangulation scheme. I guess I am used to Polygon Meshes where you can assume that each face is planar. Many things like a face normal do not make sense on non-planar quads. If a face isn't planar it should be split into two or more faces each of which are planar themselves (within a tolerance because you are right there is always floating point error.)

@WestLangley
Copy link
Collaborator

Yes, I am aware of the issues with non-planar quads. I was asking a policy question.

If our policy is non-planar quads are "invalid", then we need to be careful in our own examples not to generate any -- for example, in dynamic terrains.

If non-planar quads are valid for us, then perhaps we should revisit all the unresolved related issues, and try to deal with them -- like this one.

@bhouston
Copy link
Contributor

bhouston commented Mar 8, 2013

I think it should be policy that non-planar quads are invalid. Yes we can of course deal with them but it will be costly in terms of code and speed.

My suggestion is that dealing with this is generally a preprocessor step rather than within the engine itself. We could write one function on GeometryUtils that converts bad quads into triangles and people can use that to preprocess their meshes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants