mikolalysenko/mikolalysenko.github.com — pull request #3 by nsf (2013-10-12 10:00:21+00:00)
Title: Fix problem with black triangles in isosurface demo (with fixed typo in the commit comment).

The reason why it happens is because some quad faces have merged vertices. And Three.js uses only 3 first vertices to calculate the normal of the quad. But if two of these 3 first vertices are equal, the normal becomes (0, 0, 0) which leads to broken color as a result.

The solution is simple - replace the routine that calculates the normals for faces in the geometry with our own. We take "merged vertices in quads" case into account and use the opposite triangle of the quad to do the job if the
first triangle results in a broken zero normal.

P. S. Sorry for removed trailing spaces in the commit, my editor does it automatically and yours should too.