# Silhouette without stencil, how?

This topic is 4789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Oi, would like to know if it has a way to calculate the silhouette of an object without the use of the stencil... Some thing only using mathematical. Thanks Alexandre

##### Share on other sites
Can't you just render it all black with no lighting, or are we thinking of two different things?

##### Share on other sites
What I like is something like this :)

##### Share on other sites
1. Render model as normal
2. Turn off lighting, set constant outline colour
3. Render model again, with verts scaled along the normals, and culling front rather than back faces.

Of course, you're still not calculating the outline, you're just rendering it. [razz]

##### Share on other sites
So you're trying to have the edges highlighted?

There's a method in this tutorial (look under "Outlines and Highlighting") that might work, but it's not really mathematical. To quote the article, it "sounds stupid" but it works.

EDIT: Yeah, this is pretty much what OrangyTang suggested, too.

##### Share on other sites
The stencil shadow algorithm requires calculating the silhouette. Basically, you have to find cases where 2 adjucent triangles are at the "edges" of the silhouette, ie one is facing the viewer and the other is not(dotting the view vector with the face normal). The common edge of those 2 triangles is part of the silhouette. A quite unoptimized algorithm would be:

A1)Iterate all triangles
A2)For each triangle, calculate: Dot=(V.N);

B1)Iterate all triangles again
B2)Each triangle has 3 adjucent triangles. If CurrentTriangle.Dot*AdjucentTriangle.Dot<0, then add the common edge into the silhouette list.

When you're done, you can draw the silhouette with a set of GL_LINES commands.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633736
• Total Posts
3013598
×