• Advertisement
Sign in to follow this  

Stencil shadows - generating sihouette edges from strips problem

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I have a small problem when generating silhouette edges from indexed tri strips, this is how I do it (pseudo) :
num_faces = num_indices-2; // after first tri every index is one tri
int old = 0

for (i<num_faces)
{
     // tris go 0, 1, 2... 1, 2, 3... 2, 3, 4
     v1index = indices[old]
     v2index = indices[old+1]
     v3index = indices[old+2]
     old++;

     // compute normal
    ...

     if (nomral.dot(light)>=0)
     {
         AddEdge(v1index, v2index)
         AddEdge(v2index, v3index)
         AddEdge(v3index, v1index)
     }
}
What's the problem here?

Share this post


Link to post
Share on other sites
Advertisement
Hello..

For the edge siluette you do not want every edge where thenormal is >= 0..
You want to find the edge between the part of the model that is facing towards the light and the part that is facing from the light.

That is, find the dges where on one side the normal points from the light and on the other side it points towards the light.

There should be a ready-made algorithm for thise somewhere, and if not it shouldn't be to hard to make.

Good luck!

Share this post


Link to post
Share on other sites
Thanks for replying, but I don't think that's the problem in there, because it works just fine with tri lists. :)

Oh.. and note that I'm skipping degenerated faces.

Not sure what the problem might be, it could be when I add the edges... maybe. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement