Silhouette edges

I’ve googled and found a few links.
Anyone have any other links they found useful in
calculating silhouette edges?


Yes, me, I have plenty of such very valuable links, but I won’t show them :smiley:

… no, really, can you post yours at least ? So there would be no duplicates, and would help other people too. (source code)

I just want a broad sweep of implementations and
methods out there.

I like the idea of setting the model polygon
connectivity once before hand and then comparing
polygon normals to detect the silhouette edges.
My implementation is borderline not fast enough
at the moment (my app is time critical) so maybe
I’m missing something. It’d also be nice to use
high resolution models for this stuff.


Author says “great for dense models” :

cool. Thanks man.

Have you implemented this by any chance?
or silhouette edges in general?
what’s the fastest space to calculate this stuff

I mean, if the model is transformed I would need
to transform each and every triangle before
calculating visibility from the light’s point of
view based on the plane equation of that triangle,

Wouldn’t that suck performance wise?
I think I’ve seen the light being transformed by
the inverse of the models tranformation matrix.
I’m not sure if that was exactly it, but that
doesn’t make sense to me.

Can anyone help?

I can help quite a lot on this topic.
Now you’ll have to say precisely what you want to do.

I implemented Tom Hall’s method, and it is less efficient (and very prone to errors) than the brute force method.

Actually, after months of research, the only viable one seems to be the brute force. I didn’t test sm3.0 methods though.

Do you intend to render GL_LINES ?


Really… I just read Hall’s implementation and
was going to go ahead with it.

I want to do edge rays (sort of volumetric light
eminating from the object)
sketch rendering, volumetric shadows, etc…

I just think it would be a cool thing to get into

brute force just considers each edge in the model,

you find that this works decent for high polygon
count models?

Hall’s method is wrong on some particular cases (and not the concave stuff, it sometimes simply fails completely), and we tried to polish a good implementation, but it leeched the CPU even more than the brute force (we were wondering if we should go to ASM). Clearly, you can’t rely on it as a robust method. Too bad, because stroking is a very good point.

Do you have shader model 3 ?
if yes this one will be the best : (read carefuly the Epilogue part)

If you don’t, you’ll certainly want to optimize CPU:
1/ a “concave” edge can’t be a visible silhouette edge. So if you just want to display the silhouette edges, you don’t need to compute the concave ones.
2/ You can store a buffer of edges, each containing the two face indices and the two vertex indices. When you compute your silhouettes for the current frames, fill a second, already existing “edge indices” array, that was created to the maximum size possible. Then return the position in this array of the last index. This way you avoid allocation
3/ Compute your silhouettes right after rendering your mesh (in Z for stencil, in color buffer for standard rendering, etc.) to keep paralelism
4/ Compute your silhouettes in mesh local space, you need to transform the eye vector in this space.
5/ Rely heavily on STL and inlining (or ASM) to update each face “frontorbackfacing” boolean fields.

And with this, we managed to lose no frames/sec on complex scenes (mostly because we use a lot of fill rate limited effects). Anyway, this was after months of research (kind of a failure, yes).

There is not one and only method that will perform best for all your applications. Just choose one and focus on it.


Thanks so much.

I appreciate you sharing what you’ve learned
after months of blood, sweat and tears :slight_smile:

That’s all very helpful!

I have an NV40 gen card, so shader model 3 should
be available to me.


Something very primitive:

Demo source
Engine source