Sign in to follow this  
alex_r

Silhouette without stencil, how?

Recommended Posts

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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this