Millions of facets with three.js?

faces

7 Likes

In the parabolic superposition compound eye type, seen in arthropods such as mayflies, the parabolic surfaces of the inside of each facet focus light from a reflector to a sensor array.

2 Likes

Probably a fairer definition :stuck_out_tongue:

In three-dimensional geometry a facet of a polyhedron is any polygon whose corners are vertices of the polyhedron, and is not a face.[1][2]

@Nicoco I think the term you should be taking here is ‘face’.

Agreed, a facet can mean an arbitrary number of triangles, i think the more common term is Ngon.

This definition from mathworld doesn’t have the stipulation that a facet is not a face though, I wonder if the wiki definition is non-standard?

An (n-1)-dimensional face of an n-dimensional polytope.

According to this, in 3 dimensions the terms facets and faces are synonymous.

In any case, ‘face’ is certainly the standard term across all CG and geometry literature that I’ve read.

5 Likes

Usually don’t hear the term facet in a professional context, rather in old fashioned explanations teachers still love to use.

1 Like

Ah, and the references are unavailable online…

Here is the mathworld definition for Face. “A zero-dimensional face is a vertex” etc… I think in general it is best to lean on mathematicians for definitions, as they tend to have a good eye for generalization, which both orders the existing knowledge and expands the horizons.

Completely agree - however it’s important to stick with the conventions of our field as well, and remember that mathematical terms tend to be tweaked to suit each sub-field. So, for a mathematician discussing an n-dimensional polytope, a vertex is a face, an edge is a face, a polygon is a face. But as computer graphics engineers, we’d never refer to edges or vertices (or facets) as faces. Doing so might be technically correct, but it will still lead to confusion.

1 Like

GPUs deal with triangles though, neither faces nor facets are applicable? No matter what you do, a triangle has to be rasterized.

Thanks for this post guys. I have been looking for a good example for handling tens of thousands of triangles. I modified the code a bit to incorporate 1-5 million and post processing with an audio analyzer for a demo.

5 Likes

@Nicoco Late reply, but what you describe sounds really great.

In a nutshell, it may be called “sub-object vertex culling” (Three.js culls only at the object level, not vertex level), with face sharing across objects (similar to instancing, if I understood correctly), adding the algorithms you used to make it fast (f.e. a dynamically sized “array” that grows only on the JavaScript side instead of passing to the native side for array growth, as if to implement your own C++ vector of sorts in JS).

What some folks above didn’t understand is that if you have 5 million triangles, they don’t all go to the GPU to be clipped by the vertex shader, they are clipped (culled) on the JS side, so if only 100k triangles are in the camera view, then only 100k triangles go to the shader (not 5 million) based on the double-index range you determine.

It would be amazing if you could find the time to re-write this and publish it.